Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Save and Close
Is there code I can put into a my personal workbook which would allow me to save and close all of open workbooks? I have several that are quite large and often end up with a dozen open at the end of the day, so it would be a time saver.
Thanks! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Save and Close
On Wednesday, June 20, 2018 at 4:12:53 PM UTC-4, Paul Doucette wrote:
Is there code I can put into a my personal workbook which would allow me to save and close all of open workbooks? I have several that are quite large and often end up with a dozen open at the end of the day, so it would be a time saver. Thanks! Thanks Claus! Sub CloseAndSave() Dim wbk As Workbook Application.ScreenUpdating = False For Each wbk In Workbooks If wbk.Name < ThisWorkbook.Name Then wbk.Close True End If Next Application.ScreenUpdating = True Application.Quit End Sub |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Save and Close
On Thursday, June 21, 2018 at 10:49:17 AM UTC-4, Paul Doucette wrote:
On Wednesday, June 20, 2018 at 4:12:53 PM UTC-4, Paul Doucette wrote: Is there code I can put into a my personal workbook which would allow me to save and close all of open workbooks? I have several that are quite large and often end up with a dozen open at the end of the day, so it would be a time saver. Thanks! Thanks Claus! Sub CloseAndSave() Dim wbk As Workbook Application.ScreenUpdating = False For Each wbk In Workbooks If wbk.Name < ThisWorkbook.Name Then wbk.Close True End If Next Application.ScreenUpdating = True Application.Quit End Sub I would add a check to see whether it is Read-only or not, otherwise you could get a runtime error. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Save and Close
On Thursday, June 21, 2018 at 12:37:04 PM UTC-4, Ilia Asafiev wrote:
On Thursday, June 21, 2018 at 10:49:17 AM UTC-4, Paul Doucette wrote: On Wednesday, June 20, 2018 at 4:12:53 PM UTC-4, Paul Doucette wrote: Is there code I can put into a my personal workbook which would allow me to save and close all of open workbooks? I have several that are quite large and often end up with a dozen open at the end of the day, so it would be a time saver. Thanks! Thanks Claus! Sub CloseAndSave() Dim wbk As Workbook Application.ScreenUpdating = False For Each wbk In Workbooks If wbk.Name < ThisWorkbook.Name Then wbk.Close True End If Next Application.ScreenUpdating = True Application.Quit End Sub I would add a check to see whether it is Read-only or not, otherwise you could get a runtime error. Thanks! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Save/Close All | Excel Discussion (Misc queries) | |||
To save and close | Excel Worksheet Functions | |||
Save and Close Pop Up Box...After Save and Close In VBA | Excel Programming | |||
Save and Close Pop Up Box...After Save and Close In VBA | Excel Programming | |||
Close without save | Excel Programming |