This macro will close all of the workbooks open in Excel. It requires the SaveAll macro, listed later on this page.
Public Sub CloseAll()
Dim Wb As Workbook
SaveAll
For Each Wb In Workbooks
If Wb.Name <> ThisWorkbook.Name Then
Wb.Close savechanges:=True
End If
Next Wb
ThisWorkbook.Close savechanges:=True
End Sub
Public Sub CloseAll()
Dim Wb As Workbook
SaveAll
For Each Wb In Workbooks
If Wb.Name <> ThisWorkbook.Name Then
Wb.Close savechanges:=True
End If
Next Wb
ThisWorkbook.Close savechanges:=True
End Sub
No comments:
Post a Comment