ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Which routine called Sub()? (https://www.excelbanter.com/excel-programming/288186-routine-called-sub.html)

mikeang[_4_]

Which routine called Sub()?
 
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


---
Message posted from http://www.ExcelForum.com/


Tom Ogilvy

Which routine called Sub()?
 
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.

--
Regards,
Tom Ogilvy


"mikeang " wrote in message
...
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


---
Message posted from http://www.ExcelForum.com/





All times are GMT +1. The time now is 02:52 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com