私は引っ張ったこの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