Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Bonni Garcia   on Nov 23 In MS Office Category.

  
Question Answered By: Ruairidh Anderson   on Nov 23

Try this... it works for me. You need to create a reference to Outlook for the
code to be executed.


Sub Send_Msg()
Dim objOL As New Outlook.Application
Dim objMail As MailItem
Dim rowNum As Integer

Set objOL = New Outlook.Application
For rowNum = 2 To ActiveWorkbook.Worksheets(1).UsedRange.Rows.Count
Set objMail = objOL.CreateItem(olMailItem)
Application.DisplayAlerts = False
With objMail
.To = ActiveWorkbook.Worksheets(1).Cells(rowNum, 1).Value
.Subject = "ABCD"
.Body = "Hello " & ActiveWorkbook.Worksheets(1).Cells(rowNum, 2).Value & ","
& vbCr & vbCr & _
ActiveWorkbook.Worksheets(2).Cells(1, 1) & vbCr & _
ActiveWorkbook.Worksheets(2).Cells(3, 1) & vbCr & _
ActiveWorkbook.Worksheets(2).Cells(5, 1) & vbCr & _
ActiveWorkbook.Worksheets(2).Cells(7, 1) & vbCr & _
ActiveWorkbook.Worksheets(2).Cells(9, 1) & vbCr & _
.Send

End With
Next rowNum
Set objMail = Nothing
Set objOL = Nothing
End Sub

Share: 

 

This Question has 1 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Excel Tasks to Outlook Or get search suggestion and latest updates.


Tagged: