Code
Sub Download_attachments()
Dim olapp As Outlook.Application
Dim olmail As MailItem
Dim Att As Object
Dim olfolder As Outlook.Folder
Dim namap As NameSpace
strfolderpath = "O:\sgSales\Shared\sgPOD\Documents\CreditNDFax\"
Set olapp = CreateObject("Outlook.Application")
Set olmail = olapp.CreateItem(olMailItem)
Set olfolder = olapp.GetNamespace("MAPI").PickFolder
For Each olmail In olfolder.Items.Restrict("[Unread]=true")
olmail.UnRead = False
If TypeName(olmail) = "MailItem" Then
m = 1
For Each Att In olmail.Attachments
strfile = olmail.Attachments.Item(m).FileName
strfile = strfolderpath & strfile
olmail.Attachments.Item(m).SaveAsFile strfile
Next Att
Else
Exit Sub
End If
Next
End Sub
Display More
This code is meant to download attachments to Outlook messages that are unread , then to mark them as read ( they are faxed to me and i process them in outlook currently, hoping to have them be more easily accessible in the folder creditNDfax and eventually see about using an OCR to rename them but for now this is a big step). It handles the task but it then only does a few messages at a time and requires me to re-run the macro until all the attachments have been cleared and marked read.
Any help on this would be huge.