Continue to Site

Welcome to MCAD Central

Join our MCAD Central community forums, the largest resource for MCAD (Mechanical Computer-Aided Design) professionals, including files, forums, jobs, articles, calendar, and more.

API / Const / Variable Issue

ljacobs

New member
Hi, thanks for reading and for any advice ahead of time!


I'm writing a program to help automate the process of making shop drawings for basic pipe fittings. Its incredibly easy to do, but it takes far too much time overall away from bigger and better things.


The program is coming along nicely, but I went through yesterday and cleaned up the code and added a laundry list of Constants to make my life easier. Some of the constants I wrote included references to excel cells, like so...


Public Const xJobNo = "xlSheet.Cells(1, 1)"
Public Const xSavePath = "xlSheet.Cells(1, 8)"
Public Const xItemName = "xlSheet.Cells(2, 8)"
Public Const xEndPrepChk = "xlSheet.Cells(2, 1)"
Public Const xProdTypeChk = "xlSheet.Cells(5, 1)"
Public Const xBevName1 = "xlSheet.Cells(3, 8)"
Public Const xBevName2 = "xlSheet.Cells(4, 8)"


The problem I'm running into is that when I reference the constant in the code and try to change that cell's value, like so...


xEndPrepChk = 1


... it's assuming I want to change the variable "xEndPrepChk" to "1" instead of putting a 1 into "xlSheet.Cells(2, 1)"





I can simply have a list available with which cell is what (as I did initially), but I'd REALLY love to have these variables work.


Can anyone else think of any solution? Perhaps a different way of declaring variables that need to be active throughout the whole macro? Or another way to make it realize I don't want to reset the variable's definition?








Thanks again!
 

Sponsor

Articles From 3DCAD World

Back
Top