S
song
hi, What I want to do is to give the user a message if he does not connect
appointment to any contact and tries to close the inspector. If he choose to
cancel the close, how to cancel it?
Here is my code. But it always close, even after msgbox shows up and click
no.
Private Sub objApptItem_Close(Cancel As Boolean)
Dim myLinks As Links
On Error Resume Next
Set objApptItem = objInsp.CurrentItem
Set myLinks = objApptItem.Links
If myLinks.Count = 0 Then
If MsgBox("This appointment has no contact related, do you want to
exit?", vbOKCancel, "Appointment Exit") = vbYes Then
Cancel = True
Exit Sub
End If
End If
Cancel = False
End Sub
appointment to any contact and tries to close the inspector. If he choose to
cancel the close, how to cancel it?
Here is my code. But it always close, even after msgbox shows up and click
no.
Private Sub objApptItem_Close(Cancel As Boolean)
Dim myLinks As Links
On Error Resume Next
Set objApptItem = objInsp.CurrentItem
Set myLinks = objApptItem.Links
If myLinks.Count = 0 Then
If MsgBox("This appointment has no contact related, do you want to
exit?", vbOKCancel, "Appointment Exit") = vbYes Then
Cancel = True
Exit Sub
End If
End If
Cancel = False
End Sub