Re: calling "variable names" procedure
Thank you Andy,
in the meantime I found out how it worked. It' a really advanced programming topic approcing VBA to the VC++ features.
For the one of you who are interested here is an example;
Sub main()
Dim strg As String, i As Integer
i = 10
Select Case i
Case 1
strg = "func" & i
Case 2
strg = "func" & i
Case Else
strg = "func99"
End Select
Evaluate (strg & "(" & i & ")")
End Sub
Function func1(a As Integer)
MsgBox "I'm 1"
End Function
Function func2(a As Integer)
MsgBox "I'm 2"
End Function
Function func99(a As Integer)
MsgBox "I'm Else"
End Function
There is no need of hardcoding the function names in a "select case" or "if... Else" statements; you can pass them as arguments to a main function.
function mainfunc(funcName as string)
mainfunc=Evaluate(funcName & "()") <==== adapt code for custom code
end function
filo65