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.
 

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

Back
Top