Is it possible to use something like variable(nameOfVariable) = myValue
What am I doing:
My macro XLA Add-Inuses many module level variables; many of which Public256 are Const. Part of the public is some kind of pseudo-construction, which from time to time falls upon the contents of the config.init file (available network).
Thus, I need to assign a value to the Public variables heap , at the beginning of the macro or when the user starts some specific procedures.
The contents of the config.init file is very simple:
nameOfVariable1,value1
nameOfVariable2,value2
nameOfVariable3,value3
...
I am currently setting theses variables with this initialization procedure :
Do While Not EOF(1) ' Loop until end of config.init
Line Input #fnum, TextLine ' Read line into variable Textline
myNameOfVariable = Split(TextLine, ",")(0)
Select Case myNameOfVariable
Case "nameOfVariable1"
nameOfVariable1 = Split(TextLine, ",")(1)
Case "nameOfVariable2"
nameOfVariable2 = Split(TextLine, ",")(1)
Case "nameOfVariable3"
nameOfVariable3 = Split(TextLine, ",")(1)
...
Loop
, OfVariable Select Case , , , (= Split(TextLine, ",")(1)).
Select Case - :
Do While Not EOF(1) ' Loop until end of config.init
Line Input #fnum, TextLine ' Read line into variable.
nameOfVariable = Split(TextLine, ",")(0)
If thisvariableexist(nameOfVariable) then
variable(nameOfVariable) = Split(TextLine, ",")(1)
End if
Loop
, ( Const).
VBA?