Here is one I use to save and close all opened files including the file
housing the macro and leaving excel.
Sub CLOSE_ALL()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
For Each w In Application.Workbooks
If w.Name <> ThisWorkbook.Name Then
w.Save
w.Close
' w.Close SaveChanges:=True
'MsgBox w.Name
End If
Next w
ThisWorkbook.Save
Application.Quit
End Sub

Signature
Don Guillett
Microsoft MVP Excel
SalesAid Software
dguillett1@austin.rr.com
> Excel 2002 SP3
> Win XP Pro SP2
[quoted text clipped - 7 lines]
>
> Thanks a million!
stef - 22 Jan 2008 22:53 GMT
Don,
Thanks, very useful.
I would like to have a separate macro or action to just Save All but not
CLOSE the files, IOW continue to work with them.
Anything?
> Here is one I use to save and close all opened files including the file
> housing the macro and leaving excel.
[quoted text clipped - 13 lines]
> Application.Quit
> End Sub
Don Guillett - 22 Jan 2008 23:02 GMT
Just comment out or delete the w.close line

Signature
Don Guillett
Microsoft MVP Excel
SalesAid Software
dguillett1@austin.rr.com
> Don,
> Thanks, very useful.
[quoted text clipped - 21 lines]
>> Application.Quit
>> End Sub
stef - 23 Jan 2008 00:37 GMT
Don,
Doesn't work. It closes and exits anyway....
I must be doing something wrong....
How should the code be then?
Like this?
Application.ScreenUpdating = False
Application.DisplayAlerts = False
For Each w In Application.Workbooks
If w.Name <> ThisWorkbook.Name Then
w.Save
' w.Save SaveChanges:=True
'MsgBox w.Name
End If
Next w
ThisWorkbook.Save
Application.Quit
End Sub
> Just comment out or delete the w.close line
Dave Peterson - 23 Jan 2008 00:53 GMT
Application.quit
will close excel.
Remove that line, too.
> Don,
> Doesn't work. It closes and exits anyway....
[quoted text clipped - 17 lines]
>
> > Just comment out or delete the w.close line

Signature
Dave Peterson
stef - 23 Jan 2008 01:00 GMT
Right, thanks.
I was too focused on the code above to even notice that....
I'm losing it ;)
> Application.quit
> will close excel.
[quoted text clipped - 22 lines]
>>
>>> Just comment out or delete the w.close line
Dave Peterson - 23 Jan 2008 02:23 GMT
That never happens to me <vvbg>.
> Right, thanks.
> I was too focused on the code above to even notice that....
[quoted text clipped - 26 lines]
> >>
> >>> Just comment out or delete the w.close line

Signature
Dave Peterson