![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Feb 2002
Location: England
Posts: 212
|
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 |
|
New Member
Join Date: Apr 2002
Posts: 23
|
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 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Monterrey, Mexico
Posts: 1,433
|
To add onto codger's code, try application.displayalerts=false before workbooks.close. This will turn off the save box.
__________________
Kind regards, Al Chara |
|
|
|
|
|
#4 |
|
Board Regular
Join Date: Feb 2002
Location: England
Posts: 212
|
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 |
|
New Member
Join Date: Apr 2002
Posts: 23
|
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. |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|