View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Sharad Naik Sharad Naik is offline
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