Save en closing all open Excel-files

mulderm

Registered User.
Local time
Today, 08:34
Joined
Jul 3, 2004
Messages
13
Hello,

I want to place vba-code in module1 to do all excel-files who is
open to save and to close.
I thought:

Sub test()
Dim ex As New Excel.Application
For Each w In ex.Workbooks
w.Close savechanges:=True
Next w
End Sub

but this is not working.
Any idea?

mulderm
 
Sub test()
Dim ex As New Excel.Application
For Each w In ex.Workbooks
w.Save
w.Close
Next w
End Sub
 
Thank you.

mulderm
 

Users who are viewing this thread

Back
Top Bottom