Closing down all open files within Excel
Closing down all open files within Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 5 of 5

Thread: Closing down all open files within Excel

  1. #1
    Board Regular
    Join Date
    Feb 2002
    Location
    England
    Posts
    212
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

     
    Is there a line of code that will close all files open at the present time in excel rather than writing code to close each seperate workbook?

    thanks

    Matt

  2. #2
    New Member
    Join Date
    Apr 2002
    Posts
    23
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    In Excel, holding down the shift key when selecting 'File' from the menu produces a 'Close All' option.

    In code, you can do,

    Workbooks.Close


  3. #3
    MrExcel MVP Al Chara's Avatar
    Join Date
    Feb 2002
    Location
    Newark, Delaware
    Posts
    1,701
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    To add onto codger's code, try application.displayalerts=false before workbooks.close. This will turn off the save box.
    Best regards,
    Allan Chara
    http://www.mrspreadsheets.com

  4. #4
    Board Regular
    Join Date
    Feb 2002
    Location
    England
    Posts
    212
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Thanks Codger, I was trying to specify workbooks("*.*").close and hence failed dismally. Interesting holding the shift key down and then going to the file menu - haven't seen that before! Any other interesting variations that add buttons to the standard menus?

  5. #5
    New Member
    Join Date
    Apr 2002
    Posts
    23
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

      
    Open experimentation has yielded only shift+edit for copy and paste picture. That's useful for capturing screenshots and passing them around in spreadsheets (like from IT challenged users in an email).

    One use for the close all is the ability to save hidden workbooks; elsewise you (more or less) have to exit before you're given the chance to save them.

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
  •  

 

 
DMCA.com