Consulting

Results 1 to 6 of 6

Thread: Send multiple different pdf to contacts on list

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Send multiple different pdf to contacts on list

    Hi! Im new here and really looking forward to learn about vba , in the meantime, I wanted to ask your kind help in order to sort this out.
    I receive several different pdf files on outlook, the subject will always be the invoice number, then customers name.

    I have an excel list , and what I want to achieve is basically run a macro so that way it will search for a file within a folder (files are named after the emails subject) then attach it and send it to the contact person on the list.


    So far I have the following code:



    Sub macro()

    Dim olApp As Outlook.Application
    Dim olMail As Outlook.MailItem
    Dim fso
    Dim file As String


    For I = 2 To Sheet1.Cells(Rows.Count, 1).End(xlUp).Row
    Set olApp = New Outlook.Application
    Set olMail = olApp.CreateItem(olMailItem)

    With olMail
    .To = Cells(I, 1).Value
    .subject = Cells(I, 2).Value
    .body = Cells(I, 3).Value
    .Attachments.Add Range("D2").Value & "\" & Range("E2").Value & ".pdf"
    .Send

    End With

    Next

    End Sub

    But the thing s all I have been able to achieve is to send emails with the same file attached (in this case the file on E2)
    Anything you guys can suggest ? running out of options
    Attached Images Attached Images

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •