ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   macro name same as module name = problem (https://www.excelbanter.com/excel-programming/358142-macro-name-same-module-name-%3D-problem.html)

No Name

macro name same as module name = problem
 
I created a couple macros and they work fine.
I then had the bright idea to rename the modules from module1 module2 to
something useful which happened to be the same as the macro name.
So when I looked at the macro in the list instead of the normal list of
macros I was used to, i.e.

DoSomething
DoSomethingelse
DoYetSomethingElse

The ones I renamed were shown like they were in a different workbook, i.e.

worksheet.xls!DoSomething.DoSomething
worksheet.xls!DoSomethingelse.DoSomethingelse
worksheet.xls!DoYetSomethingElse.DoYetSomethingEls e

This caused a third party reporting tool to die a horrible death when it
tried to call them.
Prefixing all the names with "mod" solved the problem.

Can anyone explain why this renameing happens? Is it a VBA "feature" or just
somethign I should have known about?




Bob Phillips[_6_]

macro name same as module name = problem
 
Don't know about should have, but you know now. It is not a good idea to use
the same name for a macro and a module, with or without your third party
tool, it can confuse VBA.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

wrote in message
...
I created a couple macros and they work fine.
I then had the bright idea to rename the modules from module1 module2 to
something useful which happened to be the same as the macro name.
So when I looked at the macro in the list instead of the normal list of
macros I was used to, i.e.

DoSomething
DoSomethingelse
DoYetSomethingElse

The ones I renamed were shown like they were in a different workbook, i.e.

worksheet.xls!DoSomething.DoSomething
worksheet.xls!DoSomethingelse.DoSomethingelse
worksheet.xls!DoYetSomethingElse.DoYetSomethingEls e

This caused a third party reporting tool to die a horrible death when it
tried to call them.
Prefixing all the names with "mod" solved the problem.

Can anyone explain why this renameing happens? Is it a VBA "feature" or

just
somethign I should have known about?






No Name

macro name same as module name = problem
 
True enough. As do others now.
It was surprising to the third party vendor as well and a lesson I won't
soon forget.

"Bob Phillips" wrote in message
...
Don't know about should have, but you know now. It is not a good idea to
use
the same name for a macro and a module, with or without your third party
tool, it can confuse VBA.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

wrote in message
...
I created a couple macros and they work fine.
I then had the bright idea to rename the modules from module1 module2 to
something useful which happened to be the same as the macro name.
So when I looked at the macro in the list instead of the normal list of
macros I was used to, i.e.

DoSomething
DoSomethingelse
DoYetSomethingElse

The ones I renamed were shown like they were in a different workbook,
i.e.

worksheet.xls!DoSomething.DoSomething
worksheet.xls!DoSomethingelse.DoSomethingelse
worksheet.xls!DoYetSomethingElse.DoYetSomethingEls e

This caused a third party reporting tool to die a horrible death when it
tried to call them.
Prefixing all the names with "mod" solved the problem.

Can anyone explain why this renameing happens? Is it a VBA "feature" or

just
somethign I should have known about?









All times are GMT +1. The time now is 05:49 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com