我有一位员工将word文档,excel文档和其他可编辑文档附加到电子邮件中,并在发送电子邮件之前"忘记"将它们另存为pdf。我希望有一种方法来警告用户而不是阻止该操作,因为有时我们仍然需要通过电子邮件发送文档。
这可能吗。我们有一个MS Outlook 2010 Professional。
我可以在VBA的默认表单上捕获添加附件事件并获取文件扩展名吗,如果不是pdf,则显示一个简单的消息框。我可以在默认电子邮件表单上执行此操作吗?
我最终使用的代码,因为这些是 3 种主要文件类型,它们不断以 PDF 文件的形式发送。
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim STRfn As String, STRft As String, FileFlag As Boolean, Mbox
FileFlag = False
Mbox = ""
For Each oAtt In Item.Attachments
STRfn = oAtt.FileName
STRft = Right(STRfn, Len(STRfn) - InStrRev(STRfn, "."))
Select Case STRft
Case "xls", "xlsx", "xlsm"
Mbox = MsgBox("The attachment: " & STRfn & " is an EXCEL document and should be a PDF before sending this email." & vbCrLf & "DO YOU WANT TO SEND ANYWAY?", vbExclamation + vbYesNo + vbDefaultButton2, "NON PDF ATTACHMENT")
If Mbox = 7 Then
FileFlag = True
Exit For
End If
Case "dox", "docx"
Mbox = MsgBox("The attachment: " & STRfn & " is an WORD document and should be a PDF before sending this email." & vbCrLf & "DO YOU WANT TO SEND ANYWAY?", vbExclamation + vbYesNo + vbDefaultButton2, "NON PDF ATTACHMENT")
If Mbox = 7 Then
FileFlag = True
Exit For
End If
Case "vsd", "vss", "vst"
Mbox = MsgBox("The attachment: " & STRfn & " is an VISIO DRAWING and should be a PDF before sending this email." & vbCrLf & "DO YOU WANT TO SEND ANYWAY?", vbExclamation + vbYesNo + vbDefaultButton2, "NON PDF ATTACHMENT")
If Mbox = 7 Then
FileFlag = True
Exit For
End If
End Select
Next
If FileFlag = True Then Cancel = True
结束子