Want to send email through VBA

kmishra3

New Member
Joined
Nov 15, 2014
Messages
2
Hello Dear,

I want to send multiple emails using VBA i have a data in which column "A" contains email IDs column "B" contains subject and column "C" contains text that needs to be displayed on the email body.

Please help me.
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
.
.


Try something like this:

Code:
Sub SendEmails()
  'Requires reference to MS
  'Outlook object library
  
  Dim lngLastRow As Long
  Dim lngCounter As Long
  Dim objOlApp As Outlook.Application
  Dim objMItem As Outlook.MailItem
  
  lngLastRow = Cells(Rows.Count, 2).End(xlUp).Row
  Set objOlApp = New Outlook.Application
  
  For lngCounter = 2 To lngLastRow
    Set objMItem = objOlApp.CreateItem(olMailItem)
    With objMItem
      .To = Cells(lngCounter, 2).Value
      .Subject = Cells(lngCounter, 3).Value
      .Body = Cells(lngCounter, 4).Value
      .Display
    End With
  Next lngCounter
    
  Set objMItem = Nothing
  Set objOlApp = Nothing
End Sub
 
Upvote 0
Hi Gpeacock thanks a lot for your reply could you tell me from starting how this programming is working?

I will be very grateful to you.
 
Upvote 0

Forum statistics

Threads
1,215,945
Messages
6,127,840
Members
449,411
Latest member
adunn_23

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top