Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
can I call a procedure with a variable as part of the procedure's name?
I have a whole bunch of procedures named something_somethingelse_click() can I concatenate 2 variables and make them part of the call? thanks |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Your request confuses me.
I don't know of a way to discover the procedure name that is running. for example - this doesn't exist: sub mytestproc() msgbox application.current_procedure_running() end sub If you're asking if one procedure could handle lots of different events -I think VB.NET handles this well. I don't know when Excel will start using this (or if it has already in XL2003) If none of the above fits, you could do similar to the following: sub something_somethingelse_click() something "somethingelse" end sub sub something_somethingdifferent_click() something "somethingdifferent" end sub sub something(strvariable as string) if strvariable = "somethingelse" then msgbox "wow!" elseif strvariable = "somethingdifferent" then msgbox "that's a relief" else msgbox "no idea!" end if end sub "Santiago Gomez" wrote in message ... can I call a procedure with a variable as part of the procedure's name? I have a whole bunch of procedures named something_somethingelse_click() can I concatenate 2 variables and make them part of the call? thanks |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Application.Run StringVar
"Santiago Gomez" wrote in message ... can I call a procedure with a variable as part of the procedure's name? I have a whole bunch of procedures named something_somethingelse_click() can I concatenate 2 variables and make them part of the call? thanks |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks, I think this is what I need, however, I get errors when I try
running a procedure this way. This is what I have...a simple example: Sub ProcedureOne() Application.Run "mysub1", "test" End Sub Sub mysub1(sTemp As String) Debug.Print sTemp End Sub When I run this I get Error 2517, "Can't find the procedure 'mysub1.'. I've tried, no quotes, single quotes, etc. any ideas? "Tim Zych" wrote in message ... Application.Run StringVar "Santiago Gomez" wrote in message ... can I call a procedure with a variable as part of the procedure's name? I have a whole bunch of procedures named something_somethingelse_click() can I concatenate 2 variables and make them part of the call? thanks |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
It works for me. Do you have any syntax errors anywhere else in your
project? Add Option Explicit to every module and sheet then Debug - Compile.. "Santiago Gomez" wrote in message ... Thanks, I think this is what I need, however, I get errors when I try running a procedure this way. This is what I have...a simple example: Sub ProcedureOne() Application.Run "mysub1", "test" End Sub Sub mysub1(sTemp As String) Debug.Print sTemp End Sub When I run this I get Error 2517, "Can't find the procedure 'mysub1.'. I've tried, no quotes, single quotes, etc. any ideas? "Tim Zych" wrote in message ... Application.Run StringVar "Santiago Gomez" wrote in message ... can I call a procedure with a variable as part of the procedure's name? I have a whole bunch of procedures named something_somethingelse_click() can I concatenate 2 variables and make them part of the call? thanks |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
doh!, I just realized I am in the wrong application. I am using Access, not
excel. sorry guys, i added th option explicit but it still doesnt work. I do get the intelli popup thingie when I type Application.Run, is this a difference between access and excel? thanks anyway for your help. "Tim Zych" wrote in message ... It works for me. Do you have any syntax errors anywhere else in your project? Add Option Explicit to every module and sheet then Debug - Compile.. "Santiago Gomez" wrote in message ... Thanks, I think this is what I need, however, I get errors when I try running a procedure this way. This is what I have...a simple example: Sub ProcedureOne() Application.Run "mysub1", "test" End Sub Sub mysub1(sTemp As String) Debug.Print sTemp End Sub When I run this I get Error 2517, "Can't find the procedure 'mysub1.'. I've tried, no quotes, single quotes, etc. any ideas? "Tim Zych" wrote in message ... Application.Run StringVar "Santiago Gomez" wrote in message ... can I call a procedure with a variable as part of the procedure's name? I have a whole bunch of procedures named something_somethingelse_click() can I concatenate 2 variables and make them part of the call? thanks |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Don't know why it's not working for you. I tried it in Access 2000 and it
worked. Does it help if you try it out in a new database? Also make sure that mysub1 procedure is Public and not Private. "Santiago Gomez" wrote in message ... doh!, I just realized I am in the wrong application. I am using Access, not excel. sorry guys, i added th option explicit but it still doesnt work. I do get the intelli popup thingie when I type Application.Run, is this a difference between access and excel? thanks anyway for your help. "Tim Zych" wrote in message ... It works for me. Do you have any syntax errors anywhere else in your project? Add Option Explicit to every module and sheet then Debug - Compile.. "Santiago Gomez" wrote in message ... Thanks, I think this is what I need, however, I get errors when I try running a procedure this way. This is what I have...a simple example: Sub ProcedureOne() Application.Run "mysub1", "test" End Sub Sub mysub1(sTemp As String) Debug.Print sTemp End Sub When I run this I get Error 2517, "Can't find the procedure 'mysub1.'. I've tried, no quotes, single quotes, etc. any ideas? "Tim Zych" wrote in message ... Application.Run StringVar "Santiago Gomez" wrote in message ... can I call a procedure with a variable as part of the procedure's name? I have a whole bunch of procedures named something_somethingelse_click() can I concatenate 2 variables and make them part of the call? thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
call procedure problem | Excel Discussion (Misc queries) | |||
to call procedure in a worksheet in a module | Excel Discussion (Misc queries) | |||
Selective call procedure | Excel Programming | |||
call procedure | Excel Programming | |||
procedure won't call | Excel Programming |