Results 1 to 6 of 6

call/run module

Threaded View

  1. #1
    Registered User
    Join Date
    02-27-2009
    Location
    Newark, USA
    MS-Off Ver
    2007
    Posts
    29

    call/run module

    I wrote a simple macro that opens a file and moves thru the sheets (20) in the file.
    I also wrote 3 other macros. Each stored in a different module within the same file. In total the file has 4 macros/modules. The first one opens the target file and the other 3 perform different functions.
    I want to only have to run the first macro and have the other 3 ran as needed. This is what I envision:

    Sub Macro1()
    ChDir "C:\04 Apr 11"
    Workbooks.Open FileName:= _
    "W:\04 Apr 11\Apr 2011 Calculation.xls" _
    , UpdateLinks:=0
    Sheets("Alternate Site").Select
    Run Macro2()
    Sheets("Principal Site").Select
    Run Macro2()
    Run Macro4()
    Sheets("Home Site").Select
    Run Macro2()
    Run Macro3()
    End Sub

    When i run the code above I get this compile error: 'Expected variable or procedure, not module'. . The error happens right at the first Run Macro2(). To fix this I changed to "Run Macro2" then I recieved error '1004' 'Cannot run the macro 'Macro2'. The macro may not be available in this workbook or all macros may be disable.

    How do I fix this?

    Thank you
    Last edited by Pedroluna; 05-25-2011 at 03:53 PM.

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