View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default 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?