+ Reply to Thread
Results 1 to 6 of 6

Macro not running past command to close another workbook

  1. #1
    Registered User
    Join Date
    10-04-2009
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    77

    Macro not running past command to close another workbook

    The following code exists in my main file, HBPOS3.xls

    Please Login or Register  to view this content.
    The workbook I wish to close is entered in the UpgradeFile cell in HBPOS3.xls's Setup sheet.

    For test purposes this value is "HBPOS3_03Jan11.xls"

    The macro functions right and says that it is going to close... It then closes.

    But once HBPOS3_03Jan11.xls is closed, it will not do anything in HBPOS3.xls. It's like the macro has now ended and it's ignoring the rest of the script.

    Does anyone know where I've gone wrong or how I can make the rest of the macro execute after it's closed the other file?

    Thanks

  2. #2
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Macro not running past command to close another workbook

    This will suffice:
    Please Login or Register  to view this content.



  3. #3
    Registered User
    Join Date
    10-04-2009
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    77

    Re: Macro not running past command to close another workbook

    Quote Originally Posted by snb View Post
    This will suffice:
    Please Login or Register  to view this content.
    It closes HBPOS3_03Jan11.xls but doesn't load Dashboard afterwards, just shows the frontpage of HBPOS3.xls

    Thanks

  4. #4
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Macro not running past command to close another workbook

    Is a userform, called 'dashboard' present in the file HBPOS3.xls ?

    Please post an example file.

  5. #5
    Registered User
    Join Date
    10-04-2009
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    77

    Re: Macro not running past command to close another workbook

    Quote Originally Posted by snb View Post
    Is a userform, called 'dashboard' present in the file HBPOS3.xls ?

    Please post an example file.
    Dashboard only exists in HBPOS3.xls

    Dashboard does not exist in HBPOS_03012011.xls

    I need it to close HBPOS_03012011.xls and then load up Dashboard in HBPOS3.xls after.

    I've tried this as well:

    Please Login or Register  to view this content.
    I tried that as when you open HBPOS3.xls it will automatically load up Dashboard anyway but it closes HBPOS3.xls and leaves HBPOS_03112011.xls open.

    In both cases, it closes the first file and then stops working on the rest of macro once its executed the first closure.

    I would post both workbooks but there's a lot of setting up that you'd need to do...
    You have to define the path to the file in the setup page, then create a couple of folders in that folder for it to work properly.

    Regards

  6. #6
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Macro not running past command to close another workbook

    I can check your file without using macros.
    It won't be necessary to modify it apart from sensitive data.

+ 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