LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default Passing a Sub's name as parameter

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

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing parameter to a query Dwaine Horton[_3_] Excel Programming 6 April 26th 05 02:24 AM
?Passing argument/parameter just starting[_2_] Excel Programming 0 October 23rd 04 07:56 PM
?Passing argument/parameter just starting Excel Programming 1 October 23rd 04 04:23 PM
Passing a parameter to Excel keepitcool Excel Programming 3 August 13th 03 03:57 AM


All times are GMT +1. The time now is 05:04 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"