ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How can I save all open excel files? (https://www.excelbanter.com/excel-discussion-misc-queries/241363-how-can-i-save-all-open-excel-files.html)

Cobaum

How can I save all open excel files?
 
Is there a way to save all open Excel files with one command? I am working
on annual budget and have ~70 open files and I toggle back and forth so often
I forget what I saved. Is there one command that will save them all at the
same time? I can click on the red close-excel "X" at the top and click yes
to all, but I do not want to close them. Suggestions? Thanks in advance.

Dave Peterson

How can I save all open excel files?
 
You could use a macro:

Option Explicit
Sub SaveThemAll()
Dim wkbk As Workbook
Dim okCtr As Long

okCtr = 0
For Each wkbk In Application.Workbooks
If wkbk.Path = "" Then
'hasn't been saved, so skip it
Else
If wkbk.Saved = True Then
'skip it, why bother
Else
On Error Resume Next
wkbk.Save
If Err.Number < 0 Then
MsgBox "Error saving: " & wkbk.FullName _
& vbLf & Err.Number & vbLf & Err.Description
Err.Clear
Else
Beep 'some indicator
Application.StatusBar = "Saved: " & wkbk.Name & " at " & Now
okCtr = okCtr + 1
End If
On Error GoTo 0
End If
End If
Next wkbk

Application.StatusBar = False

MsgBox okCtr & " of " & Application.Workbooks.Count & " saved."

End Sub

If you're new to macros:

Debra Dalgleish has some notes how to implement macros he
http://www.contextures.com/xlvba01.html

David McRitchie has an intro to macros:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Ron de Bruin's intro to macros:
http://www.rondebruin.nl/code.htm

(General, Regular and Standard modules all describe the same thing.)

Cobaum wrote:

Is there a way to save all open Excel files with one command? I am working
on annual budget and have ~70 open files and I toggle back and forth so often
I forget what I saved. Is there one command that will save them all at the
same time? I can click on the red close-excel "X" at the top and click yes
to all, but I do not want to close them. Suggestions? Thanks in advance.


--

Dave Peterson

Don Guillett

How can I save all open excel files?
 
Here's one I use to save and close all and leave Excel

Sub CLOSE_ALL()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
For Each w In Application.Workbooks
w.Save
Next w
application.Quit
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Cobaum" wrote in message
...
Is there a way to save all open Excel files with one command? I am
working
on annual budget and have ~70 open files and I toggle back and forth so
often
I forget what I saved. Is there one command that will save them all at
the
same time? I can click on the red close-excel "X" at the top and click
yes
to all, but I do not want to close them. Suggestions? Thanks in advance.



Cobaum

How can I save all open excel files?
 
So Excel never put in thier program? I am surprized. I would have thought
that there would have been a command...
Thanks for the help.

"Cobaum" wrote:

Is there a way to save all open Excel files with one command? I am working
on annual budget and have ~70 open files and I toggle back and forth so often
I forget what I saved. Is there one command that will save them all at the
same time? I can click on the red close-excel "X" at the top and click yes
to all, but I do not want to close them. Suggestions? Thanks in advance.



All times are GMT +1. The time now is 02:43 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com