Vincent paul
New Member
- Joined
- Oct 8, 2014
- Messages
- 22
Hi,
I'm trying to close all the file except the macro file. But it closes all the files including macro file.
Any help / clarification would be appreciated.
Sub exceptwb()
Dim wb As Workbook
Application.DisplayAlerts = False
For Each wb In Workbooks
If wb.Name <> ThisWorkbook.Name Then
Workbooks.Close
End If
Next wb
Application.DisplayAlerts = True
End Sub
I'm trying to close all the file except the macro file. But it closes all the files including macro file.
Any help / clarification would be appreciated.
Sub exceptwb()
Dim wb As Workbook
Application.DisplayAlerts = False
For Each wb In Workbooks
If wb.Name <> ThisWorkbook.Name Then
Workbooks.Close
End If
Next wb
Application.DisplayAlerts = True
End Sub