Macro.ExecutingProcName
Use this property to get the currently executing procedure name. Prerequisite for the property is that macro must be running. This property is read only.
SVB Example
Tracing a call stack:
Option Base 1 Option Explicit Dim m As Macro Dim CallStackText As String Sub Main 'iterate through the macros to find the one 'that is currently running (which will 'happen to be this one) For Each m In Macros If m.Run = True Then Exit For Next m 'begin writing to the report CallStackText = m.ExecutingProcName FirstFunction SecondFunction ThirdFunction 'write a report displaying the call stack sequence 'throughout the macro Dim r As New Report r.SelectionText = CallStackText r.Visible = True End Sub Sub FirstFunction CallStackText = CallStackText & vbCrLf & m.ExecutingProcName End Sub Sub SecondFunction CallStackText = CallStackText & vbCrLf & m.ExecutingProcName End Sub Sub ThirdFunction CallStackText = CallStackText & vbCrLf & m.ExecutingProcName End Sub
Copyright © 2020. Cloud Software Group, Inc. All Rights Reserved.