+ Reply to Thread
Results 1 to 23 of 23

send email from excel to multiple recipients

Hybrid View

  1. #1
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: send email from excel to multiple recipients

    Hi, Hari,

    as you changed the look of the sheet I kindly ask you to provide me with the updated code you use to send mail from that sheet. And please confirm that this is the final look of the sheet as there needs a column to be added (date of mail sent or day pending when mail was sent) as well as a formula being used for Column P days pending.

    so I would like to request you to provide me code for to add if condition
    The way I would go for a solution was laid out and there were several scenarios. As you want to adjust 2 macros on your own the If-Statements I feel that are needed are a check for the pending (Iīd apply an Autofilter to Column P) and for the date the last mail was sent.

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: send email from excel to multiple recipients

    Hi, Hari,

    right now Iīm facing the fact that the macro that worked on the old file doesnīt create a mail on my system after I adapted it for the changes. Could you please check on your system if itīs working?

    Sub Notify_121204()
    Dim WS As Worksheet, rngArea As Range, rngCell As Range
    Dim OutApp As Object, OutMail As Object
    Dim Msg As String
    
    Set WS = ThisWorkbook.Sheets("Hold-Data")
    With WS
      If .AutoFilterMode Then
        .Range("A1:R1").AutoFilter
        .Range("A1:R1").AutoFilter Field:=17, Criteria1:="0-15days"
      Else
        .Range("A1:R1").AutoFilter Field:=17, Criteria1:="0-15days"
      End If
    End With
    On Error Resume Next
    Set rngArea = WS.Range(WS.Cells(2, 17), WS.Cells(WS.Cells(Rows.Count, 17).End(xlUp).Row, 17)).SpecialCells(xlCellTypeVisible)
    If rngArea Is Nothing Then Exit Sub
    On Error GoTo 0
    Set OutApp = CreateObject("Outlook.Application")
    For Each rngCell In rngArea
      If Len(WS.Cells(rngCell.Row, "T").Value) = 0 Then
        Msg = "Dear Sir/Madam" & Chr(13) & Chr(13)
        Msg = Msg & "Kindly provide the following clarification/ input required that we came across while processing your claim." & vbCrLf
        Msg = Msg & "We would need your inputs to proceed further on processing of this claim." & vbCrLf & vbCrLf & _
            "Vendor Claim Details: Document No./ Ref No. " & WS.Cells(rngCell.Row, "A")  '<--- this is just a guess from my side
        Msg = Msg & " [ having Invoice No. " & WS.Cells(rngCell.Row, "C").Value & " ] "
        Msg = Msg & "of Vendor code " & WS.Cells(rngCell.Row, "D").Value & "  of Vendor Name: " & WS.Cells(rngCell.Row, "E").Value & vbCrLf & vbCrLf
        Msg = Msg & "Reason for Holding " & WS.Cells(rngCell.Row, "N").Value & vbCrLf & "Kindly attach the finance head approval for releasing the payment."
        
        Msg = Msg & Chr(13) & Chr(13) & "*************************************************************************** **********"
        Msg = Msg & Chr(13) & "If the Hold document is not resolved within 15 days from hold date the claim will be REJECTED."
        Msg = Msg & Chr(13) & "*************************************************************************** **********"
        Msg = Msg & Chr(13) & Chr(13) & "For further clarification please feel free to conduct us"
        Msg = Msg & Chr(13) & Chr(13) & "Regards, " & vbCrLf & "Team"
        
        Set OutMail = OutApp.CreateItem(0)
        On Error Resume Next
        With OutMail
          .To = WS.Cells(rngCell.Row, "J").Value
          .CC = WS.Cells(rngCell.Row, "R").Value
          .BCC = ""
          .Subject = "Your Bills on HOLD"
          .Body = Msg
          .Send
        End With
        Set OutMail = Nothing
        WS.Cells(rngCell.Row, "T").Value = WS.Cells(rngCell.Row, "P").Value
      End If
    Next rngCell
    End Sub
    Ciao,
    Holger

  3. #3
    Registered User
    Join Date
    11-17-2012
    Location
    Bangalore
    MS-Off Ver
    Excel 2010
    Posts
    38

    Re: send email from excel to multiple recipients

    Hi Holger,

    i think E-mail has to pick from the Hold-data sheet i guess ? can you please check on this please

    Regards,
    Hari

  4. #4
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: send email from excel to multiple recipients

    Hi, Hari,

    Quote Originally Posted by hariexcel1987
    It’s filtering the data but I am unable to send an E-mail to the recipient , actually it’s hanging could you please look into this
    Quote Originally Posted by HaHoBe
    right now Iīm facing the fact that the macro that worked on the old file doesnīt create a mail on my system after I adapted it for the changes.
    No, I canīt as I am on vacation right now and only know that an update on Windows has taken place but donīt know whatīs been changed there (and currently am on a very slow net next to beating bytes into the net).

    Maybe I will be able to check this on the start of next week when Iīm back at work as I need a system with Outlook (and the laptop Iīm working on doesnīt do the job nor does it feed me with adequate information from the net in a reasonable time).

    Ciao,
    Holger

  5. #5
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: send email from excel to multiple recipients

    Hi, Hari,

    the reason for Outlook not getting the mail might be the contents of Column R (have to fill manually). If you change the command .Send to .Display the mail will be displayed in Outlook. Or better you change the contents in Column R to valid e-mail addresses and try to run the macro again.

    Ciao,
    Holger

  6. #6
    Registered User
    Join Date
    12-26-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    18

    Re: send email from excel to multiple recipients

    Whether "email to multiple recipients" cannot be solved, if mailmerge option in MSWord is used?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1