+ Reply to Thread
Results 1 to 3 of 3

macro name same as module name = problem

  1. #1
    Guest

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




  2. #2
    Bob Phillips
    Guest

    Re: 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)

    <[email protected]> wrote in message
    news:%[email protected]...
    > 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?
    >
    >
    >




  3. #3
    Guest

    Re: 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" <[email protected]> wrote in message
    news:[email protected]...
    > 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)
    >
    > <[email protected]> wrote in message
    > news:%[email protected]...
    >> 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?
    >>
    >>
    >>

    >
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1