Save All...

S

stef

Excel 2002 SP3
Win XP Pro SP2

Hi,

Is there a way to do a Save All (all opened files) in a similar fashion
as clicking Shift|File|Close All ?

Failing that, any macros out there I could use?

Thanks a million!
 
D

Don Guillett

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
 
S

stef

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?
 
S

stef

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
 
S

stef

Right, thanks.
I was too focused on the code above to even notice that....
I'm losing it ;)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top