Home |
Search |
Today's Posts |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
no that is the point I made, if the last module you updated was module 3 that
module seems to retain the active setting. I don't know how to set the module for the sub you are running, as the active code window, or perhaps some other method needs to be found "Harald Staff" wrote: Hi Richard I've ran code like this Sub test3() ClientName = Application.VBE.ActiveCodePane.CodeModule.Name MsgBox ClientName End Sub placed in three different modules. They all returned "Module3", not the module containing the running code. Am I missing something ? Best wishes Harald "Richard" skrev i melding ... Harald I got it, Dim ClientName As String ClientName = Application.VBE.ActiveCodePane.CodeModule.Name This enables me to give each module the client name, which in turn allows me to use the ClientName string as part of the file path. No need to search through and make code changes for each new client and the sub name can be whatever I like, which is handy as in some cases I have more than 1 sub for the same client. Richard "Harald Staff" wrote: Hi R Afaik no, sorry. It would make error handling far easier if it was. Best wishes Harald "Richard" skrev i melding ... Hi Is it possible to read either the module and/or the sub name and use it as a string within the code? R |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Compile Error in Hidden Module: Module 1 | Excel Programming | |||
Add a VBA Module from a String instead of from a file | Excel Programming | |||
Use String from another module | Excel Programming | |||
Excel VBA to search all macro code in Excel module for specific string criteria | Excel Programming | |||
Variable from a sheet module in a class module in XL XP | Excel Programming |