How can I access the content of a variable/constant X when I use a variable Y which contains the name of the first variable, i.e. X?
Similarly how can I run a function/procedure if I call it using a variable containing its name?
I know there are many alternative ways to do that, but I'd like to know if someone is aware of how to do exactly what I need (no public variables, no arrays).
I want to do something like the following:
Thank you for your help.
Nath.
Similarly how can I run a function/procedure if I call it using a variable containing its name?
I know there are many alternative ways to do that, but I'd like to know if someone is aware of how to do exactly what I need (no public variables, no arrays).
I want to do something like the following:
Code:
'*******
Public const MYCONST1 = "Portfolio1.txt"
Public const MYCONST2 = "Portfolio2.txt"
Sub Test()
Dim i as Integer
For i = 1 to 2
Open "MYCONST" & i For Input as #1
'I want it to open Portfolio1.txt and
'Portfolio2.txt but it will try to open
'MYCONST1 and MYCONST2 instead, which are
'not existing files!
Next i
End Sub
'*******
A similar problem is:
Sub Test2()
...
sType = "Rectangle"
...
Call "Print" & sType
'I want it to call the procedure PrintRectangle
End Sub
Sub PrintRectangle()
...
End Sub
'********************
Thank you for your help.
Nath.