Save all files opened

  • Thread starter Thread starter Carpe Diem
  • Start date Start date
C

Carpe Diem

Hi,

I usually use about 15 files at the same time and I would like to
arrange a way to save all files at once instead of save the files one
by one.

Anyone knows a add in or a macro that could do this ?

Thank you

Ricardo
 
I found this example in the VBA help (see below) I would think this would
work
Set fc = f.Files
For Each f1 in fc
f1.close
Next



Sub ShowFolderList(folderspec)
Dim fs, f, f1, fc, s
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(folderspec)
Set fc = f.Files
For Each f1 in fc
s = s & f1.name
s = s & vbCrLf
Next
MsgBox s
End Sub
 
Thank you for your help, I will try
Joel said:
I found this example in the VBA help (see below) I would think this would
work
Set fc = f.Files
For Each f1 in fc
f1.close
Next



Sub ShowFolderList(folderspec)
Dim fs, f, f1, fc, s
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(folderspec)
Set fc = f.Files
For Each f1 in fc
s = s & f1.name
s = s & vbCrLf
Next
MsgBox s
End Sub
 
Ricardo,
I assume you mean open Excel files in you instance of Excel:


Private Sub CommandButton1_Click()
Dim WB As Workbook

For Each WB In Workbooks
'Avoid hidden WBs, e.g. Personal.xls etc
If WB.Windows(1).Visible = True Then
WB.Save
End If
Next

End Sub

NickHK
 

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

Back
Top