Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi All,
How can I pass the name of a Sub to be called to an other Sub (which is expected to execute the call) as a parameter? Stefi |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Stefi..
do you mean s'thing like: Sub ProcA() dim s as String select case Range("A1").Value case 1: s="Proc1" case 2: s="Proc2" case else: msgbox "invalid input": exit sub end select call ProcB(s) end sub Sub ProcB(sSubProc as string) 'do 'common' stuff if sSubProc = "Proc1" then call Proc1 elseif sSubProc = "Proc2" then call Proc2 end if 'note:could have used another select case above :) end sub sub proc1() end sub sub proc2() end sub Instead of passing the argument you could use a module level variable. -- keepITcool | www.XLsupport.com | keepITcool chello nl | amsterdam Stefi wrote : Hi All, How can I pass the name of a Sub to be called to an other Sub (which is expected to execute the call) as a parameter? Stefi |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hello Stefi, Here is an example... Sub Test(ByVal SubName As String) Application.Run SubName End Sub Sincerely, Leith Ros -- Leith Ros ----------------------------------------------------------------------- Leith Ross's Profile: http://www.excelforum.com/member.php...fo&userid=1846 View this thread: http://www.excelforum.com/showthread.php?threadid=38046 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks Leith,
That was the very method I was looking for! Regards, Stefi €˛Leith Ross€¯ ezt Ć*rta: Hello Stefi, Here is an example... Sub Test(ByVal SubName As String) Application.Run SubName End Sub Sincerely, Leith Ross -- Leith Ross ------------------------------------------------------------------------ Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465 View this thread: http://www.excelforum.com/showthread...hreadid=380462 |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hi all, how can I end one procedure from another? Thank you, Sergey -- Sergey_vba ------------------------------------------------------------------------ Sergey_vba's Profile: http://www.excelforum.com/member.php...o&userid=24437 View this thread: http://www.excelforum.com/showthread...hreadid=380462 |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
In general, VBA will only execute one procedure at a time - if you call
another sub or function, execution of the first suspends until the one you called is done. So I am not clear on what you want to do - please give more details. "Sergey_vba" wrote: Hi all, how can I end one procedure from another? Thank you, Sergey -- Sergey_vba ------------------------------------------------------------------------ Sergey_vba's Profile: http://www.excelforum.com/member.php...o&userid=24437 View this thread: http://www.excelforum.com/showthread...hreadid=380462 |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() I have complicated code in which two procedures call each other man times (without ending). This cycle may last quite long depending on th value entered by user. The sub will stop under certain conditions, but some times “call stack” memory is not enough and I get “out of stack error”. So when code “jumps” from Sub1 to Sub2, I’d like to End Sub1 fro Sub2. Thank you, Sergey In general, VBA will only execute one procedure at a time - if yo call another sub or function, execution of the first suspends until th one you called is done. So I am not clear on what you want to do - pleas give more details. "Sergey_vba" wrote: Hi all, how can I end one procedure from another? Thank you, Sergey -- Sergey_vb -- Sergey_vb ----------------------------------------------------------------------- Sergey_vba's Profile: http://www.excelforum.com/member.php...fo&userid=2443 View this thread: http://www.excelforum.com/showthread.php?threadid=38046 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Passing parameter to a query | Excel Programming | |||
?Passing argument/parameter | Excel Programming | |||
?Passing argument/parameter | Excel Programming | |||
Passing a parameter to Excel | Excel Programming |