+ Reply to Thread
Results 1 to 5 of 5

Workbooks("").Close Crashes Excel With Mutiple Workbooks Open

  1. #1
    Registered User
    Join Date
    09-16-2011
    Location
    Who Knows, Where
    MS-Off Ver
    Excel 2007
    Posts
    14

    Workbooks("").Close Crashes Excel With Mutiple Workbooks Open

    I am having an issue with some VBA. When the workbook I'm working with is the only one open, Workbooks("").Close works fine. When I have another workbook open at the same time, it will close but then crash Excel. Here's my code:

    Please Login or Register  to view this content.
    I need to check if the file has been saved in a new location or not. Could the other open workbook be throwing it off, even though it isn't even being referenced in the code? Thank you for your help!
    Last edited by exs120; 09-27-2011 at 12:37 PM.

  2. #2
    Registered User
    Join Date
    09-16-2011
    Location
    Who Knows, Where
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Workbooks("").Close Crashes Excel With Mutiple Workbooks Open

    Any ideas?

  3. #3
    Forum Expert Whizbang's Avatar
    Join Date
    08-05-2009
    Location
    Greenville, NH
    MS-Off Ver
    2010
    Posts
    1,395

    Re: Workbooks("").Close Crashes Excel With Mutiple Workbooks Open

    This:
    Please Login or Register  to view this content.
    Could be this:
    Please Login or Register  to view this content.
    This will close the workbook without saving. I do not know if it will prevent Excel from crashing, but it does save some time.

  4. #4
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: Workbooks("").Close Crashes Excel With Mutiple Workbooks Open

    You've only waited an hour or so, sometimes problems can't be solved right away. Please show some patience and I'm sure you'll have an answer soon enough.

    Thanks
    If you're happy with someone's help, click that little star at the bottom left of their post to give them Reps.

    ---Keep on Coding in the Free World---

  5. #5
    Registered User
    Join Date
    09-16-2011
    Location
    Who Knows, Where
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Workbooks("").Close Crashes Excel With Mutiple Workbooks Open

    Thank you Whizbang. I tried your code, but got the same result. Because I require users to re-save the file elsewhere, the error does not occur from the new save location. Only if they keep using the file from its original location. I have other code that asks if they want to SaveAs. If they say no, then the error would come up when closing ONLY if they have another workbook open at the same time. Very puzzling.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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