编写Outlook VBA以检查外发电子邮件所需的顾问 [英] Consultant required to write Outlook VBA to check outgoing email
问题描述
嗨
这里的任何人都可以引用为Outllook写一些VBA来执行类似下面的操作吗?
would anybody here be able to quote to write some VBA for Outllook that does something like the following?
。 ...........................
............................
点击发送(或替换发送的按钮)
When clicking send (or button that replaces send)
如果附件存在
显示提示。 "您确定要通过电子邮件地址com向客户发送附件名称.pdf"
Display prompt. "Are you sure you wish to send Attachment name.pdf to customer at email dot com"
如果是,则发送/如果否,则不执行任何操作。
If yes then send /If no then do nothing.
..............................
..............................
这里的目的是提醒人们确保他们将写入附件发送给正确的收件人
The purpose here is to prompt people to ensure they send the write attachments to the right recipient
谢谢并抱歉基本术语。
推荐答案
嗨Mportt,
Hi Mportt,
我想你可以用
ItemSend 事件来做这个提示。
I think you could use ItemSend event to do this prompt.
这是一个例子。
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim mail As MailItem
Dim att As Attachment
Dim rec As Recipient
If TypeName(Item) = "MailItem" Then
Set mail = Item
If mail.Attachments.Count > 0 Then
For Each att In mail.Attachments
attNameStr = attNameStr & att.FileName & ","
Next att
attNameStr = Left(attNameStr, Len(attNameStr) - 1)
For Each rec In mail.Recipients
recAddressStr = recAddressStr & rec.Address & ","
Next rec
recAddressStr = Left(recAddressStr, Len(recAddressStr) - 1)
strMsg = "Are you sure you wish to send " & attNameStr & _
"To " & recAddressStr
res = MsgBox(strMsg, vbYesNo + vbDefaultButton1)
If res = vbNo Then
Cancel = True
End If
End If
End If
End Sub
最好的问候,>
Terry
Best Regards,
Terry
这篇关于编写Outlook VBA以检查外发电子邮件所需的顾问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!