Call a Variable Procedure Name

  • Thread starter Thread starter Turner
  • Start date Start date
T

Turner

I would like to be able to use a Variable as a procedure
name. I tried the example below to no avail. Is there a
way to accomplish:

Const stMyMsg As String = "myMsg"

Call stMyMsg

I have a procedure called myMsg.

Thanks!
 
You have to use a function name.


Public Function stMyMsg

msgbox "hello..this is stMyMsg"

end function


Then you can go in code:

dim strWhatFunc as string

strWhatFunc = "stMyMsg"

eval(stWhatFunc)

So, using eval, you can call a function. It don't work for subs..but useally
this is not a problem....
 
Back
Top