My co-worker is writing a VB script and she wants to call a function that is stored in a string, but she doesn’t want to write a long switch statement.
I told her it was easy to do in Perl but she wasn’t amused. Any ideas?
Well of course I tried MSDN, but I couldn’t come up with the right search terms. [I guess I should have just browsed the list of functions, but I didn’t think of that.]
Eval didn’t work though – we kept getting syntax errors. She had to use Execute [which was at the bottom of the Eval help page you linked to].
This worked:
dim proc
proc = "Call myFunction(arg)"
Execute proc