PDA

View Full Version : call stack question?



drawworkhome
02-01-2010, 09:52 AM
hi all,
does anyone know if it is possible to determine if a particular sub or function has been called programmatically and use it as a boolean value (or assign it a varible)?
would this be a scripting process vs a vba process?
is it a crazy idea?
thank you.

Jan Karel Pieterse
02-01-2010, 10:37 AM
Called programmatically as opposed to what?

drawworkhome
02-01-2010, 10:50 AM
Called programmatically as opposed to what?
i have a function that more than one sub goes to. i would like to create some kind of program flow control based on which sub called the function.

mdmackillop
02-01-2010, 11:28 AM
Something like

Option Explicit

Sub Test1()
Call MyTest(1)
End Sub

Sub Test2()
Call MyTest(2)
End Sub

Sub MyTest(data As Long)
Select Case data
Case 1
'do something
Case 2
'do something else
Case Else
'do nothing
End Select
End Sub

drawworkhome
02-01-2010, 11:45 AM
hi md,
i will give it a try.
thank you.
erik