Below Outlook rules is supposed to save the attachment from [email protected] with Gift Card Purchase subject line to disk then move the email to the Delete Items folder so that it won't process it again. The rule runs when it receives the new email and moved the email to the Delete Items folder but it did not save the attachment.
I suspect the rule move the message to the Delete Items folder first then execute the script to save the email attachment which is no longer in the Inbox folder.
I cannot change the sequence of the Outlook rule below to execute the script first then move the message but Outlook does not allow.
Any recommendation?
Apply this rule after the message arrives
from [email protected]
and with Gift Card Purchase in the subject
and on this computer only
move it to the Deleted Items folder
and run Project1.SaveAttachment
Public Sub SaveAttachment(MItem As Outlook.MailItem)
Dim oAttachment As Outlook.Attachment
Dim sSaveFolder As String
sSaveFolder = "C:\Temp\"
For Each oAttachment In MItem.Attachments
oAttachment.SaveAsFile sSaveFolder & oAttachment.DisplayName
Next
End Sub