以下是我想要发生的步骤或类似的步骤。如果没有审查特殊说明,我基本上想要一个取消电子邮件的对话框:
这是我现在使用的代码;然而,无论我点击什么,它都会发送电子邮件...任何帮助都会很棒。
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
If Item.Categories = "Special Delivery" And MsgBox("Did you review delivery instructions?", vbOKCancel) <> vbOK Then
Cancel = True
End If
End Sub
答案 0 :(得分:0)
取出Item.Categories
,因为Item
在您回复并使用vbOKCancel) = vbCancel
实施例
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim Prompt As String
Prompt = "Did you review delivery instructions?"
If MsgBox(Prompt, vbOKCancel) = vbCancel Then
Cancel = True
End If
End Sub
答案 1 :(得分:-1)
您可以通过分离它们来确定问题所在。
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
If Item.Categories = "Special Delivery" Then
debug.print "Item has Special Delivery category"
If MsgBox("Did you review delivery instructions?", vbOKCancel) <> vbOK Then
Cancel = True
End If
Else
debug.print "If item has Special Delivery category it was not identified"
End If
End Sub