Which SUB is calling this SUB

calendar_today Asked Jun 11, 2013
thumb_up 9 upvotes
history Updated April 16, 2026

Question posted 2013 ยท +7 upvotes

Does anyone out there know how to do a stack trace in . I’m trying to do something like:

Public Sub a()   
    Call c    
End Sub    

Public Sub b()    
    Call c    
End Sub

Public Sub c()    
    Debug.Print "Which sub has called me ?"    
End Sub

What I want to do in Sub c is to show if that has been called by Sub a or Sub b without passing any arguments. In I would simply show the stack but I have no idea if this is even possible in VBA – any thoughts ?

Accepted answer +9 upvotes

You can access the call stack during runtime under the menu View -> Call Stack

Alternatively you can use the keyboard shortcut CTRL+L during runtime.

enter image description here

Top vba Q&A (6)

+9 upvotes ranks this answer #46 out of 81 vba solutions on this site .
vba