Thanks Thanks:  0
Likes Likes:  0
Results 1 to 4 of 4

Thread: Help! Need code for closing Workbook without saving it

  1. #1
    Guest

    Default

    I have a summary Workbook with code in it that, in sequence, opens 20 subsidiary Workbooks, copies data from each to a sheet in the summary Workbook, and then closes each of the subsidiary Workbooks. The last line in each section of the code, to close that particular subsidiary Workbook is "ActiveWindow.Close"
    My problem is that, when the code reaches this point, a message box appears, asking me if I "want to save the changes you made to"'filename.xls'?" and I have to click on "No" 20 times. I could change the code to "ActiveWorkbook.Save" and it would eliminate the clicking, but it would take an extra minute or two to run the full macro, and this is on a workbook that I open at least 5 times a day.
    My question is: Is there any code to close the subsidiary workbook without saving it, and without having to click in each message box?

  2. #2
    MrExcel MVP Barrie Davidson's Avatar
    Join Date
    Feb 2002
    Location
    Winnipeg
    Posts
    2,330
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    On 2002-03-08 08:50, Anonymous wrote:
    I have a summary Workbook with code in it that, in sequence, opens 20 subsidiary Workbooks, copies data from each to a sheet in the summary Workbook, and then closes each of the subsidiary Workbooks. The last line in each section of the code, to close that particular subsidiary Workbook is "ActiveWindow.Close"
    My problem is that, when the code reaches this point, a message box appears, asking me if I "want to save the changes you made to"'filename.xls'?" and I have to click on "No" 20 times. I could change the code to "ActiveWorkbook.Save" and it would eliminate the clicking, but it would take an extra minute or two to run the full macro, and this is on a workbook that I open at least 5 times a day.
    My question is: Is there any code to close the subsidiary workbook without saving it, and without having to click in each message box?
    ActiveWindow.Close (False)

    Regards,
    Barrie Davidson

    "You're only given a little spark of madness. You mustn't lose it." - Robin Williams

  3. #3
    Board Regular Barry Katcher's Avatar
    Join Date
    Feb 2002
    Location
    Dog Beach, Florida. Yeaahh!
    Posts
    4,053
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Thanks, Barrie. What took you so long?
    Barry Katcher

  4. #4
    MrExcel MVP Barrie Davidson's Avatar
    Join Date
    Feb 2002
    Location
    Winnipeg
    Posts
    2,330
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    On 2002-03-08 09:02, Barry Katcher wrote:
    Thanks, Barrie. What took you so long?
    Barry Katcher
    Sorry, I guess I'm just getting old

    PS - why do you spell your name the wrong way?
    Barrie Davidson

    "You're only given a little spark of madness. You mustn't lose it." - Robin Williams

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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