calvarado536
Technical User
Hello everyone.
I'm trying to create a rule that runs a code on a certain email that comes into my inbox. This email always has 2 files in csv form. They are called non-delivered_email_report_YYYMMDD and Batch_Failed_Report_YYYYMMDD. I would only like to save the non-delivered_email_report but in txt form. This is the code that I have so far but this saves all the attachments in the form they are. How can I get it to save only the email report and in txt form? Much appreciated.
I'm trying to create a rule that runs a code on a certain email that comes into my inbox. This email always has 2 files in csv form. They are called non-delivered_email_report_YYYMMDD and Batch_Failed_Report_YYYYMMDD. I would only like to save the non-delivered_email_report but in txt form. This is the code that I have so far but this saves all the attachments in the form they are. How can I get it to save only the email report and in txt form? Much appreciated.
Code:
Public Sub saveAttach(itm As Outlook.MailItem)
Dim objAtt As Outlook.Attachment
Dim saveFolder As String
saveFolder = "I:\My Documents\email report"
For Each objAtt In itm.Attachments
objAtt.SaveAsFile saveFolder & "\" & objAtt.DisplayName
Set objAtt = Nothing
Next
End Sub