我有這個VBA代碼,我將它附加到規則中,以便它在到達時自動打印.pdf附件和電子郵件。是否可以添加一個標誌,如果它成功打印?將完整的標誌添加到電子郵件
Private Declare Function ShellExecute Lib "shell32.dll" Alias _
"ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, _
ByVal lpFile As String, ByVal lpParameters As String, _
ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Sub PrintAttachments(oMail As Outlook.MailItem)
Dim colAtts As Outlook.Attachments
Dim oAtt As Outlook.Attachment
Dim sFile As String
Dim sDirectory As String
Dim sFileType As String
sDirectory = "C:\Users\USER\Desktop\PDFS\Print\"
Set colAtts = oMail.Attachments
If colAtts.Count Then
For Each oAtt In colAtts
sFileType = LCase$(Right$(oAtt.FileName, 4))
Select Case sFileType
' Add additional file types below followed by comma
Case ".pdf"
sFile = sDirectory & oAtt.FileName
oAtt.SaveAsFile sFile
oMail.PrintOut
ShellExecute 0, "print", sFile, vbNullString, vbNullString, 0
End Select
Next
End If
End Sub
你使用哪種版本的Outlook? – DaBeau96
我使用outlook 2013 – Xiodrade