+ Reply to Thread
Results 1 to 5 of 5

After renaming module, macros can no longer be called using application.run

  1. #1
    Registered User
    Join Date
    03-23-2012
    Location
    Boston, MA
    MS-Off Ver
    Excel 2010
    Posts
    7

    After renaming module, macros can no longer be called using application.run

    Thanks in advance! We are banging our heads on the wall with this one...

    We have built a report automation system.

    The system resides in a "master" workbook called report inventory. We have a list of file names in the "report inventory" that the system loads into an array. It then loops through the array opening each report, and calls a "main" update macro that resides within each report.

    The system was working fine until we renamed the module containing the "main" update macro (the one within each report). We have compiled the code, and we have tried renaming the module with a sub routine from within the project, but nothing is working. It breaks at this line in the code (full code included at the bottom):

    Please Login or Register  to view this content.
    Note:
    • Macros are not disabled in any of the workbooks
    • All procedures are public
    • The syntax is correct (remember it runs before we rename the module)


    The error we are getting is #1004 with a description of:
    "Cannot run the macro ''NEJM Test Report 4.xlsm'!main'. The macro may not be available in this workbook or all macros may be disabled."
    Here's our code:

    Please Login or Register  to view this content.
    Last edited by tblasko; 03-08-2013 at 12:31 PM.

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,520

    Re: After renaming module, macros can no longer be called using application.run

    What did you rename the module?
    If posting code please use code tags, see here.

  3. #3
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,965

    Re: After renaming module, macros can no longer be called using application.run

    You can get problems if a module name is the same as a macro name.
    Martin

    If my solution has saved you time and/or money, please consider sponsoring my run in the 2020 London Marathon in aid of Cancer Research UK.

    https://uk.virginmoneygiving.com/MartinRice

  4. #4
    Registered User
    Join Date
    03-23-2012
    Location
    Boston, MA
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: After renaming module, macros can no longer be called using application.run

    SOLVED:
    Quote Originally Posted by mrice View Post
    You can get problems if a module name is the same as a macro name.
    I LOVE YOU!!! We had indeed renamed the module to match the name of the macro we were trying to call from within that module. That fixed it and was obvious in retrospect. Thank you!!
    Last edited by tblasko; 03-08-2013 at 12:30 PM.

  5. #5
    Registered User
    Join Date
    07-10-2016
    Location
    Anchorage, AK
    MS-Off Ver
    2010
    Posts
    1

    Re: After renaming module, macros can no longer be called using application.run

    I know this is a few years old, but this just saved me many hours of trial and error or just having to redo what I spent the last week doing. Thank you!

+ 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