Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Save and Close all Open Workbooks using VBScript

Hi,

Doea anyone know how to automatically save and close all open workbooks?

Thanks, Rick
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 212
Default Save and Close all Open Workbooks using VBScript

can be done as under, two options: In 2nd option, Excel is closed.

Sub closing()
ThisWorkbook.Activate
For Each Window In Application.Windows
If Not Window.Index = ActiveWindow.Index Then
Window.Close Savechanges:=True
End If
Next Window
ThisWorkbook.Close Savechanges:=True
End Sub

OR

Sub quitting()
For Each w In Application.Workbooks
w.Save
Next w
Application.Quit
End Sub



"Rick De Marco" wrote in message
m...
Hi,

Doea anyone know how to automatically save and close all open workbooks?

Thanks, Rick



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to open, Update links, save and close workbooks Anton Excel Discussion (Misc queries) 0 January 7th 10 03:18 AM
Open Close workbooks bbc1 Excel Discussion (Misc queries) 2 August 28th 05 11:24 AM
Auto open 8 workbooks in different folders, then save on close... pkley[_2_] Excel Programming 0 October 11th 04 11:37 PM
Excel VBA-How to close all open workbooks except one specific? waveracerr[_13_] Excel Programming 3 February 13th 04 06:53 PM
help with macro to open and close workbooks aneurin Excel Programming 1 September 24th 03 02:14 AM


All times are GMT +1. The time now is 12:56 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"