Thanks for your answer Jan!
But, I did try the Me.Saved = True and it didn't solve
the problem. In fact my code was a bit longer than the
example i posted. Here is it in complete:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Static blnRunning As Boolean
If blnRunning = True Then Exit Sub
blnRunning = True
Me.Saved = True
Me.Activate
Me.Close SaveChanges:=False
blnRunning = False
End Sub
I have a static variable tha exits the procedure if it is
already running.
I also tried to include the Me.Activate to be shure the
workbook is activated.
Any suggestions?
/Torsten Hannerfeldt
>-----Original Message-----
>Hi Torsten,
[quoted text clipped - 20 lines]
>
>.
Jan Karel Pieterse - 08 Jan 2004 12:01 GMT
Hi Thorsten,
Strange, the example I gave you should suffice (works fine for me, even
with 6 workbooks open:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Me.Saved = True
End Sub
Regards,
Jan Karel Pieterse
Excel MVP
www.jkp-ads.com
> But, I did try the Me.Saved = True and it didn't solve
> the problem. In fact my code was a bit longer than the
[quoted text clipped - 15 lines]
> I have a static variable tha exits the procedure if it is
> already running.