View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Rob van Gelder[_4_] Rob van Gelder[_4_] is offline
external usenet poster
 
Posts: 1,236
Default can I call a procedure using a variable

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