I used Slovaks code to capture email close events to preform some checks and ask me some questions before the close completes. Sometimes when I close the email and I set the "Cancel" to True, the close event continues to fire. Sometimes it will eventually close and sometimes it keeps on cycling.
Here is the close event code:
Private Sub m_objMail_Close(Cancel As Boolean)
On Error Resume Next
If blnSkipClose <> True Then
With m_objMail
If .Subject = "" Then
If MsgBox("Subject line is blank. Coninue closing?", vbYesNo, "Blank Subject") = vbNo Then
Cancel = True
End If
End If
If .Categories = "" Then
If MsgBox("No category assigned. Assign category?", vbYesNo, "No category") = vbYes Then
.ShowCategoriesDialog
.Save
End If
End If
If .FlagStatus = olNoFlag And m_objMail.FlagIcon = olNoFlagIcon Then
If MsgBox("No reminder set. Coninue closing?", vbYesNo, "No reminder") = vbNo Then
Cancel = True
End If
End If
End With
End If
If Cancel = False Then
basOutlInsp.KillInsp m_intID, Me
Set m_objInsp = Nothing
blnSkipClose = True
End If
End Sub
Thank you for any help I can get.
-Tim.
Here is the close event code:
Private Sub m_objMail_Close(Cancel As Boolean)
On Error Resume Next
If blnSkipClose <> True Then
With m_objMail
If .Subject = "" Then
If MsgBox("Subject line is blank. Coninue closing?", vbYesNo, "Blank Subject") = vbNo Then
Cancel = True
End If
End If
If .Categories = "" Then
If MsgBox("No category assigned. Assign category?", vbYesNo, "No category") = vbYes Then
.ShowCategoriesDialog
.Save
End If
End If
If .FlagStatus = olNoFlag And m_objMail.FlagIcon = olNoFlagIcon Then
If MsgBox("No reminder set. Coninue closing?", vbYesNo, "No reminder") = vbNo Then
Cancel = True
End If
End If
End With
End If
If Cancel = False Then
basOutlInsp.KillInsp m_intID, Me
Set m_objInsp = Nothing
blnSkipClose = True
End If
End Sub
Thank you for any help I can get.
-Tim.