|
楼主 |
发表于 2011-8-18 15:04
|
显示全部楼层
版主,把这句
Set myItem = myOlApp.CreateItem(olMailItem)
改成
Set myItem = Item
之后,
代码一点儿效果都没有了,连对话框都不会弹出了。
照您的改了之后的代码:
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim myOlApp As New Outlook.Application
Dim myItem As Outlook.MailItem
Dim myAttachments As Outlook.Attachments
Dim cancelsend As Long
Set myItem = Item
Set myAttachments = myItem.Attachments
If myItem.Attachments.Count = 0 Then
cancelsend = MsgBox(" 是否忘记粘贴附件了 !" & vbNewLine & vbNewLine & " 确定要发送吗?", _
vbYesNo + vbDefaultButton2 + vbQuestion, "忘记粘贴附件提示")
If cancelsend = vbNo Then Cancel = True
End If
End Sub
改之前的代码:
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim myOlApp As New Outlook.Application
Dim myItem As Outlook.MailItem
Dim myAttachments As Outlook.Attachments
Dim cancelsend As Long
Set myItem = myOlApp.CreateItem(olMailItem)
Set myAttachments = myItem.Attachments
If myItem.Attachments.Count = 0 Then
cancelsend = MsgBox(" 是否忘记粘贴附件了 !" & vbNewLine & vbNewLine & " 确定要发送吗?", _
vbYesNo + vbDefaultButton2 + vbQuestion, "忘记粘贴附件提示")
If cancelsend = vbNo Then Cancel = True
End If
End Sub
|
|