Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 15083

Can the address of a VB Function be used to execute the function in some way?

$
0
0
Hi,

Outside of an Events context, can the address of a function obtained with GetRef(), be used in a variable which will later be used to execute the function?

What I'm trying to accomplish is sending the function name as parameter on the command line, and then executing that function inside the script, something like:

WScript test.vbs "FirstFunction"


Code:

'**** Test.vbs
Option Explicit

Function ExecuteFunction( FunctionName )
Dim RetVal

RetVal = RunThis( &Function )

ExecuteFunction = RetVal
End Function

' **** All defined functions ****


Function FirstFunction
...
End Function

Function SecondFunction
...
End Function

'*** End of test.vbs ***


Viewing all articles
Browse latest Browse all 15083

Trending Articles