If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Call a Variable Procedure Name
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! |
#2
|
|||
|
|||
Call a Variable Procedure Name
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.... -- Albert D. Kallal (Access MVP) Edmonton, Alberta Canada http://www.attcanada.net/~kallal.msn |
#3
|
|||
|
|||
Call a Variable Procedure Name
Turner,
myMsg() must be a function: Const stMyMsg As String = "myMsg()" Eval (stMyMsg) Regards, Graham R Seach Microsoft Access MVP Sydney, Australia Microsoft Access 2003 VBA Programmer's Reference http://www.wiley.com/WileyCDA/WileyT...764559036.html "Turner" wrote in message ... 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! |
Thread Tools | |
Display Modes | |
|
|