I
Ian
Using Word 97.
I want to trap a form close event, using QueryClose. However, the
following code (based on an example in Hart-Davis' "Mastering VBA6")
does not recognize the QueryClose event:
~~~~~~~~~~~~~~
Private Sub MyForm_QueryClose _
(Cancel As Integer, CloseMode As Integer)
Select Case CloseMode
Case 0
MsgBox "gotcha"
Case 1
Case 2
Case 3
End Select
End Sub
~~~~~~~~~~~~~~
When I click on the Close button, the form just closes, without
displaying the message box in Case 0. Putting a breakpoint on the
"Select Case" line shows that this point is never reached.
What is wrong with this code?
Also, where is the value of "Cancel" defined? (I believe it should be
zero for the code to work).
I want to trap a form close event, using QueryClose. However, the
following code (based on an example in Hart-Davis' "Mastering VBA6")
does not recognize the QueryClose event:
~~~~~~~~~~~~~~
Private Sub MyForm_QueryClose _
(Cancel As Integer, CloseMode As Integer)
Select Case CloseMode
Case 0
MsgBox "gotcha"
Case 1
Case 2
Case 3
End Select
End Sub
~~~~~~~~~~~~~~
When I click on the Close button, the form just closes, without
displaying the message box in Case 0. Putting a breakpoint on the
"Select Case" line shows that this point is never reached.
What is wrong with this code?
Also, where is the value of "Cancel" defined? (I believe it should be
zero for the code to work).