close all other workbooks
Hi Rob,
Try:
'=============
Private Sub Workbook_Open()
Dim WB As Workbook
For Each WB In Application.Workbooks
If WB.Name < Me.Name Then
WB.Close SaveChanges:=True 'Or False?
End If
Next WB
End Sub
'<<=============
This is workbook event code and should be pasted into the workbook's
ThisWorkbook module *not* a standard module or a sheet module:
---
Regards,
Norman
"Rob" wrote in message
...
I have a workbook that is very large and I would like a simple code that
closes any open workbooks when I open this one. I have quite a few macros
in
this workbook and I tried to use the workbooks.close statement but of
course
that closes all workbooks. I don't see see anything like Before_Open as a
macro. Can someone please help.
|