macro name same as module name = problem

G

Guest

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.DoYetSomethingElse

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?
 
B

Bob Phillips

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)
 
G

Guest

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top