"gabba" <do*****@thespam.comwrote in message
news:45********************@news.tiscali.it...
Hi,
is it possible to call a subroutine (or a function) using variable name?
Sub a()
Response.write("sub a")
End sub
Sub b()
Response.write("sub b")
End sub
Sub c()
Response.write("sub c")
End sub
Dim subname
subname = "b"
**call subname**
'does exist something like this? or something like the javascript 'eval' ?
"Eval" exists in VBScript and is described as:
"Evaluates an expression and returns the result."
"Execute" will do what you want:
"Executes one or more specified statements."
Option Explicit
Const subname = "b"
Execute subname
Sub b()
Response.write("sub b")
End sub
Or you could use:
Const subname = "b()"