Call a proc using a string variable for the proc name 
Author Message
 Call a proc using a string variable for the proc name

How can I call a procedure usinga variable for the procedure name?

Private Sub TestProcName ()
    msgbox "It works"
End Sub

Private Sub TestProcName2 ()
    dim str as string
    str = "TestProcName "
    call str
End Sub

Thanks.

--
George Padvorac

nwis.net



Thu, 09 Aug 2001 03:00:00 GMT  
 Call a proc using a string variable for the proc name


Quote:
> How can I call a procedure using a variable for the procedure name?

Use Eval.  This works with a function, so you just need to write a simple
function which calls the procedure.

Slightly convoluted, that's all.

I'd say that the use of Eval should be discouraged, though, in favour of
standard procedure calling which the code editor can perform checks on
during compilation.

--
Paul Bredbury, http://dialspace.dial.pipex.com/brebs/



Thu, 09 Aug 2001 03:00:00 GMT  
 Call a proc using a string variable for the proc name
George,

you can use Run - it's better than Eval in my opinion e.g. because of the
fact that you can use byref and object variables with it etc...

Shamil

--
Shamil Salakhetdinov
DARTS Ltd., St.Petersburg, Russia

URL: http://www.darts.spb.ru


Quote:
>How can I call a procedure usinga variable for the procedure name?

>Private Sub TestProcName ()
>    msgbox "It works"
>End Sub

>Private Sub TestProcName2 ()
>    dim str as string
>    str = "TestProcName "
>    call str
>End Sub

>Thanks.

>--
>George Padvorac

>nwis.net



Thu, 09 Aug 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Same Proc to return Integer or String variable

2. How to declare variables set in form proc but used after form unloaded

3. invalid proc call on repeated application.filesearch.filename call

4. Call Let/Get Prop using string variable for name

5. Call Let/Get Prop using string variable for name

6. Find string in all stored proc

7. Private Procedures - Calling from Other Proc's

8. calling Stored Proc with InputOutput params - help please!

9. Calling Oracle stored proc from excel VBA?

10. Calling a proc without reference


 
Powered by phpBB® Forum Software © phpBB Group