Reputation: 8064
I'll also note, that the Application.Run("<workbook name>!<public VBA function name>")
allows jumps of the execution to other workbooks without changing the ActiveWorkbook
property.
I want to know the name of the workbook which hosts the currently executing VBA code.
In case if someone did understand me wrong:
ActiveWorkbook
wouldn't do, because the active workbook might be completely different then the one, where the running VBA macro is located.Me
object isn't the ticket either. It contains the reference to the class which method is currently executing, regardless of the hosting object (it would work only if my VBA code is in a method of the Worksheet or Workbook class).Upvotes: 3
Views: 3676
Reputation: 149287
I want to know the name of the workbook which hosts the currently executing VBA code.
Debug.Print ThisWorkbook.Name
Upvotes: 6