Consulting

Results 1 to 3 of 3

Thread: Solved: Mailer code depending on variables in columns

  1. #1

    Solved: Mailer code depending on variables in columns

    Good morning all,

    I explained what I need exactly in the attached XL file.

    Thankful in advance for your help and cooperation.

    Have a good day
    Attached Files Attached Files

  2. #2
    VBAX Guru mancubus's Avatar
    Joined
    Dec 2010
    Location
    "Where I lay my head is home" :D
    Posts
    2,644
    this will display the messages, and in order to send, click SEND one by one

    [vba]Sub MailAll()

    On Error Resume Next
    For i = 2 To Range("C" & Rows.Count).End(xlUp).Row
    Set olApp = CreateObject("Outlook.Application")
    Set olMail = olApp.CreateItem(olMailItem)
    With olMail
    .To = Cells(i, "C")
    .CC = ""
    .BCC = ""
    .Subject = "Pending Vendor Invoices In Workflow as of " & Format(Now, "dd.mm.yyyy")
    .Body = "Dear Mr. " & Cells(i, "B").Value & vbNewLine & vbNewLine & _
    "Please find below list of pending invoices in your workflow for further action:" & vbNewLine & _
    "PO No. " & Cells(i, "G").Value & " and Invoice No " & Cells(i, "J").Value & _
    " are with you for " & Cells(i, "E").Value & ", which is outstanding for " & Cells(i, "G").Value & _
    " Days." & vbNewLine & "Please take proper action ASAP." & vbNewLine & vbNewLine & _
    "Kind regards." & vbNewLine & vbNewLine & "First Name and Last Name"
    .Display
    End With
    Set olApp = Nothing
    Set olMail = Nothing
    Next
    On Error GoTo 0

    End Sub
    [/vba]
    PLS DO NOT PM; OPEN A THREAD INSTEAD!!!

    1) Posting Code
    [CODE]PasteYourCodeHere[/CODE]
    (or paste your code, select it, click # button)

    2) Uploading File(s)
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) (multiple files can be selected while holding Ctrl key) / Upload Files / Done
    Replace company specific / sensitive / confidential data. Include so many rows and sheets etc in the uploaded workbook to enable the helpers visualize the data and table structure. Helpers do not need the entire workbook.

    3) Testing the Codes
    always back up your files before testing the codes.

    4) Marking the Thread as Solved
    from Thread Tools (on the top right corner, above the first message)

  3. #3
    Gr8

    Thanks a lot dear brother.

Posting Permissions

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