如何重命名与主题行相同的 pdf
附件,然后将重命名的文件通过电子邮件发送给其他收件人。
例如,我收到的电子邮件的主题行为 "123456-CHM78912"
,但附件 pdf
名称将为 { {1}} 即可。
"INV-5"
答案 0 :(得分:0)
设置Outlook规则并调用以下脚本
Option Explicit
Public Sub SaveAtmts(Item As Outlook.MailItem)
Dim Atmt As Outlook.Attachment
Dim Path As String
Dim SaveAtmt As String
Dim AtmtName As String
Path = "C:\Temp\"
AtmtName = Item.Subject & ".pdf"
For Each Atmt In Item.Attachments
If Right(Atmt.FileName, 3) = "pdf" Then
SaveAtmt = Path & AtmtName
Atmt.SaveAsFile SaveAtmt
End If
Next
' // Email the file
Set Item = Application.CreateItem(olMailItem)
With Item
.Subject = "Subject"
.body = AtmtName & " Report Attached "
.To = "0m3r@Email.com"
.Attachments.Add SaveAtmt
' // Display msg
' .Display
' ' Or Send
.Send
End With
End Sub