I don't know if I'm going crazy or if my Excel sheet is. I have the following macro in an empty workbook:
Private Sub workbook_activate()
MsgBox Application.DisplayAlerts
Application.DisplayAlerts = False
MsgBox Application.DisplayAlerts
End Sub
Pretty straight forward. Now, when I open another workbook in order to activate and deactivate the books, the following happens:
Once you jump to the new workbook and back the method engages and a box pops up saying "true". After hitting OK another box pops up saying "false". Just what I expected. When you now jump over to the other workbook and back again, the first box says "true" again and the second one "false" of course.
So jumping back and forth seems to set the Application.DisplayAlerts to true again. Can that be?
What am I missing here? I tried it on different PCs once with XL2000 once with XL2003. Same thing.
Try it out and see for yourself. Thanks for your help,
Andre
P.S.: I just realized the following:
When I type
Application.DisplayAlerts = False
and
MsgBox Application.DisplayAlerts
into the immediate window the msgbox displays "true" also... what's going on??
Private Sub workbook_activate()
MsgBox Application.DisplayAlerts
Application.DisplayAlerts = False
MsgBox Application.DisplayAlerts
End Sub
Pretty straight forward. Now, when I open another workbook in order to activate and deactivate the books, the following happens:
Once you jump to the new workbook and back the method engages and a box pops up saying "true". After hitting OK another box pops up saying "false". Just what I expected. When you now jump over to the other workbook and back again, the first box says "true" again and the second one "false" of course.
So jumping back and forth seems to set the Application.DisplayAlerts to true again. Can that be?
What am I missing here? I tried it on different PCs once with XL2000 once with XL2003. Same thing.
Try it out and see for yourself. Thanks for your help,
Andre
P.S.: I just realized the following:
When I type
Application.DisplayAlerts = False
and
MsgBox Application.DisplayAlerts
into the immediate window the msgbox displays "true" also... what's going on??