View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Roberto[_4_] Roberto[_4_] is offline
external usenet poster
 
Posts: 3
Default Before_Close problem

Hi

Before a workbook is closed I want to give user the option
of opening another one.

Private Sub Workbook_BeforeClose(Cancel As Boolean)
if Msgbox("Do you need to open 'Data2.xls'", vbYesNo) =
vbYes then
workbooks.open "C:\Data\Date2.xls"
End if
End Sub

The problem is that while the second workbook Data2 is
opened ok, the original workbook which this code is in
does not close.
I don't understand this as it's in a BeforeClose sub
I've tried putting Else ThisWorkbook.close in, but this
causes the message box to be displayed all over again.

Please Help