For example, if I have a string variable in Basic such as something = "foo"
, how can I use this variable in dot notation or the like to refer to foo.value
?
For example in JavaScript one can write [something].value
For example, if I have a string variable in Basic such as something = "foo"
, how can I use this variable in dot notation or the like to refer to foo.value
?
For example in JavaScript one can write [something].value
I’ll describe a workaround below, not the best solution.
This example is to allow a version# (iVersion
) to select a specific Library Module for settings. First here is how I would like it to work. It is how JavaScript syntax works:
sBaseModuleName = "AnnotatedBackupsSettings"
sPath = [sBaseModuleName & "V" & iVersion].GETsPath()
iMaxCopies = [sBaseModuleName & "V" & iVersion].GETiMaxCopies()
Next, here is a workaround for a limited set of variable values. Notice the ugly necessity for an overflow warning at the end.
Select Case iVersion
Case 1
sPath = AnnotatedBackupsSettingsV1.GETsPath()
iMaxCopies = AnnotatedBackupsSettingsV1.GETiMaxCopies()
Case 2
sPath = AnnotatedBackupsSettingsV2.GETsPath()
iMaxCopies = AnnotatedBackupsSettingsV2.GETiMaxCopies()
Case 3
sPath = AnnotatedBackupsSettingsV3.GETsPath()
iMaxCopies = AnnotatedBackupsSettingsV3.GETiMaxCopies()
Case Is > 3
MsgBox("OOPS, select statement is too short for iVersion = " _
& iVersion & "." &chr(10)&chr(10)&_
"Increase the number of case statements to fix this.",_
0+48,"FATAL ERROR"):stop
End Select