-
I'm looking for a way to call a procedure(sub or function) using a variable. I want to be able to:
Dim strFunctionName as String
strFunctionName = "Exit" (where Exit is the name of the sub)
Call strFunctionName
or something to this effect
Does anyone know if this is possible?
FoxPro has macro substitution that allows this sort of thing using the ampersand(&), but I don't know about VB.
-
If you have VB6 yo can do
Code:
Dim strFunctionName As String
strFunctionName = "SomeOtherSub"
CallByName Me, strFunctionName, VbMethod
strFunctionName = "ExitPgm"
CallByName Me, strFunctionName, VbMethod
If you don't have VB6 the best you can do is to create a Case statement with a case for each procedure you want to call.
Code:
Select Case strFunctionName
Case "SomeOtherSub"
SomeOtherSub
Case "ExitPgm"
ExitPgm
Case Else
MsgBox "Unrecognized procedure name"
End Select
------------------
Marty
What did the fish say when it hit the concrete wall?
> > > > > "Dam!"
[This message has been edited by MartinLiss (edited 02-15-2000).]