function to figure out which procedure

G

Guest

i need to create a function that will figure out which procedure called it
and then run the appropriate procedure based on that call.

re-wording...:::
i have several procedures that will call the same procedure.
depending on the procedure calling the procedure, another procedure is called.

or this can be done with a function... and then i will produce the results
and the procedure name

any help will be appreciated.
 
D

Die_Another_Day

Monique, add an optional string to your function.
Function XYZ(Parameters as Variant, Optional Caller as String) as
Integer
'Your code
End Function

Then call it like this:
i = XYZ(Param1, "MySub")

Charles Chickering
 
N

NickHK

Monique,
The only practical way is to have an argument in your called function that
take the name of the calling routine.
Then based your the call to subsequent routines based on that.

Function Calling
Call Called ("Calling")
End Function

Function Called (WhoCalledMe As String)
Select Case WhoCalledMe
Case "Calling"
'Decide what to do
Case Else
MsgBox "No folllowing routine specified"
End Select
End Function

NickHK
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top