Need VBA Code to send email based on unique email id.

Sayeed Ahmed M 1 Reputation point
2022-06-22T11:11:55.87+00:00

Hi team,

I need vba code to send email based on unique email id. Column L - will contain multiple email ids, therefore, based on unique email id from column L, data should be filtered and snapshot of Range A to K should be displayed on email body. it should pick .to from column L.

Multiple emails should be generated based on this code.

Please help.

Developer technologies Visual Basic for Applications
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Wafa Ibrahim Ali Asakrah 66 Reputation points
    2022-06-22T20:46:30.783+00:00

    Private Sub CommandButton1_Click()
    "To be able to send correctly and need to configure Microsoft Outlook effectively
    On Error Resume Next
    Dim rowCount, endRowNo
    Dim objOutlook As New Outlook.Application
    Dim objMail As MailItem
    Dim SigString As String
    Dim Signature As String
    'Get the number of rows In the data area to which the current worksheet is connected to cells (1,1)
    endRowNo = Application.WorksheetFunction.CountIfs(Range(“A:A”), “<>”)
    'Create objOutlook as Outlook application object
    Set objOutlook = New Outlook.Application
    'Start sending emails in a loop, like starting from the second line, the first line is the address
    For rowCount = 2 To endRowNo
    Set objMail = objOutlook.CreateItem (olMailItem) 'Create objMail as mail object
    ' Extract mail signature
    SigString = Worksheets(“Sheet1”).Cells(2, 5)
    If Dir(SigString) <> “” Then
    Signature = GetBoiler(SigString)
    Else
    Signature = “”
    End If
    With objMail
    .To = Cells (rowCount, 1) .Value Set the recipient’s address (obtained from the “Email Address” field in the first column of the Excel sheet).
    CC = Cells (rowCount, 2). Value set the CC address (obtained from the Mail Address field in the second column o

    0 comments No comments

  2. Wadha Mohammad Al Haribat 81 Reputation points
    2022-06-23T11:46:06.78+00:00

    Through the email available on the Thames or Outlook

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.