Which routine called Sub()?

  • Thread starter Thread starter mikeang
  • Start date Start date
M

mikeang

I want to know which routines are calling a particular Sub().

I thought Application.Caller would give me the result but it does not.

Private Sub Workbook_Open()

'change the Excel environment
SetEnvironment

.....
End Sub

Sub SetEnvironment()

Debug.Print Application.Caller (always returns an Error 2023)

.....
End Sub

Any ideas on the best way to find out where all the calls to a
particular sub are coming from?

Many thanks.

Mike Angellotti
 
No built in provision for this. You would have to have the calling
routines pass in their names or look at the call stack in the debugger.
 
Back
Top