A client prefers their weekly invoice attachments sent in a single e-mail.
I set up the system to send all invoices to me so that I can attach them to a single e-mail.
The macro I created saves all the attachments from e-mails in a specific Outlook folder to a specific folder on my computer. It then drafts an e-mail for me to send to my client.
I need for the macro to attach all the saved files to the drafted e-mail then delete the files from the folder on my computer.
Dim ol As Outlook.Application
Dim ns As Outlook.NameSpace
Dim fol As Outlook.MAPIFolder
Dim i As Object
Dim mi As Outlook.MailItem
Dim at As Outlook.Attachment
Set ol = New Outlook.Application
Set ns = ol.GetNamespace("MAPI")
Set fol = ns.GetDefaultFolder(olFolderInbox)
Set fol = fol.Folders("_CLIENT INVOICES")
For Each i In fol.Items
    If i.Class = olMail Then
    
        Set mi = i
        
        If mi.Attachments.Count > 0 Then
            
            For Each at In mi.Attachments
            
                If Right(at.FileName, 3) = "pdf" Then
            
                    at.SaveAsFile "C:\Users\MYNAME\OneDrive\CLIENT Invoices\" & at.FileName
                        
                End If
                
            Next at
            
        End If
        
    End If
Next i
'Drafting Email
Dim outlookapp As Object
Dim outlookmessage As Object
Set outlookapp = GetObject(Class:="Outlook.Application")
Set outlookmessage = outlookapp.CreateItem(0)
With outlookmessage
    .SentOnBehalfOfName = "OUR EMAIL"
    .To = "CLIENT EMAIL"
    .Subject = "Invoices"
    .Body = "Dear Valued Client," & vbNewLine & vbNewLine & "Attached please find the invoices for       
services provided." & vbNewLine & vbNewLine & "Thank you,"
    .Display
End With
On Error GoTo 0
Set outlookmessage = Nothing
Set outlookapp = Nothing
End Sub
 
     
    