Philcjr
10-17-2005, 07:07 AM
Need some help here...
I want to close out the activeworkbook (Book2) without saving the file if the user selects "CLOSE"
I have the following code:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.DisplayAlerts = False
ActiveWorkbook.Close Savechanges:=False
Application.DisplayAlerts = True
End Sub
The problem is, if you have a file already open (Book1) and you open the file with the above code (Book2) when you close out "Book2" you can not use any of the commandbars in "Book1" and you have to close out of Excel.
Anyway around this?
Thanks,
Phil
I want to close out the activeworkbook (Book2) without saving the file if the user selects "CLOSE"
I have the following code:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.DisplayAlerts = False
ActiveWorkbook.Close Savechanges:=False
Application.DisplayAlerts = True
End Sub
The problem is, if you have a file already open (Book1) and you open the file with the above code (Book2) when you close out "Book2" you can not use any of the commandbars in "Book1" and you have to close out of Excel.
Anyway around this?
Thanks,
Phil