Call a procedure when procedure name is stored in variable
Posted on 2007-11-21
How can I call a procedure if the procedure name is stored in a variable?
Say I have a command button named "Command1" with this code:
Private Sub Command1_Click()
Then in another sub I have this:
Dim x as string
x = "Command1_Click"
'Here I want to call the procedure that is stored in x (which would be command1's click event in this case)
I want to do that because the procedure name that is stored in x will change and I will not know what it is each time it changes, just that I need to run whatever procedure that is stored in x.
Any of you know how I can do this?