Hi all,
I keep on trying to archive my emails from outlook via vba. I have managed to download the emails with certain names and save the attachments. What I have not been able to do is this: I want to save the attachments which are really attached by the sender in the attached area. What I don't want to do is save all the pictures/frames which usually come in signatures and logo's. The code that I have now keeps seeing these pictures and logos and attachments which results in a pile of image.png and a lot of LinkedIn and Twitter logo's.
Here is a section of my code:
If Item.Attachments.Count = 0 Then
' Email bevat geen bijlagen. Email wordt opgeslagen in Email directory
If Dir(StrMail, vbDirectory) = "" Then
Item.SaveAs StrMail
Else
GoTo 104
End If
ElseIf Item.Attachment.Count >= 1 Then
' Email bevat bijlagen. Bijlagen worden opgeslagen in Bijlagen directory
' Email wordt opgeslagen in Email directory
If Dir(StrMail, vbDirectory) = "" Then
Item.SaveAs StrMail
Else
GoTo 104
End If
For Each oatt In Item.Attachments
If Dir(DirAtt & oatt.FileName, vbDirectory) = "" Then
oatt.SaveAsFile DirAtt & oatt.FileName
End If
Next
End If
Can somebody help me how to figure out that only the attachments which are attached by the sender will be downloaded?
Thanks in advance.