Public Const Const1 = 1
The above can be put under (General) (Declarations) of a Model in Excel VBA.
If I set strCmd = "Public Const Const1 = 1", is there a way to run this command in strCmd?
Technology Tips and News
Public Const Const1 = 1
The above can be put under (General) (Declarations) of a Model in Excel VBA.
If I set strCmd = "Public Const Const1 = 1", is there a way to run this command in strCmd?
The line
Public Const Const1 = 1
is not a command, but a declaration. You cannot "run" it - for example, if you copy the above line into the Immediate window and press Enter, you'll get an error message.
You can use code to place code, including declarations, into a module - see http://www.cpearson.com/excel/vbe.aspx
Hi,
Please see Mr. Hanss explanation first, and this is the forum to discuss questions and feedback for Microsoft Excel, if you have further question about VBA, I recommend you post the question to the MSDN forum for Excel
http://social.msdn.microsoft.com/Forums/en-US/home?forum=exceldev&filter=alltypes&sort=lastpostdesc
The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.
George Zhao