I realize that there are a number of examples of this, but for some reason I'm having issues adjusting them to my own needs.
My goal is simple. Within a specific folder (subfolder?), find email with matching subject line, create a folder in C: with the date of the email, and download the email attachment to the just created folder.
The newly created folder piece hasn't been included yet because a) not sure exactly how to go about doing that and b) I can't seem to save the simple attachment to an already created test folder.
Any help MUCH appreciated!
Thank you!
Here's what I have so far:
![]()
Sub DownloadAttachment() Dim ns As Namespace Dim Inbox As MAPIFolder Dim Item As Outlook.MailItem Dim Atmt As Attachment Dim FileName As String Set ns = Outlook.GetNamespace("MAPI") Set Inbox = ns.GetDefaultFolder(olFolderInbox).Parent.Folders("Personal").Folders("Fund") For Each Item In Inbox.Items If Item.Subject = "HELLO THIS IS A TEST" Then FileName = "C:\Test\Attachments\" & Atmt.FileName Atmt.SaveAsFile FileName End If Next Item End Sub
Bookmarks