SBendBuckeye
Programmer
I am trying to determine the currently running module in Excel VBA. The code is in a macro file that is hidden in Excel. If I single step through the code and print the following in the immediate window it has a value.
Application.VBE.ActiveCodePane.CodeModule.name
If I do the following in code, it comes back vbNullString:
strName = Application.VBE.ActiveCodePane.CodeModule.name
But it is inconsistent. It does not always come back empty. I believe that I also tried but I don't honestly remember:
ThisWorkBook.Application.VBE.ActiveCodePane.CodeModule.name
Any ideas why this would not come back properly 100% of the time? Thanks in advance for any help or suggestions you can give me!
Have a great day!
Application.VBE.ActiveCodePane.CodeModule.name
If I do the following in code, it comes back vbNullString:
strName = Application.VBE.ActiveCodePane.CodeModule.name
But it is inconsistent. It does not always come back empty. I believe that I also tried but I don't honestly remember:
ThisWorkBook.Application.VBE.ActiveCodePane.CodeModule.name
Any ideas why this would not come back properly 100% of the time? Thanks in advance for any help or suggestions you can give me!
Have a great day!