Note # This code is just the basic, needs to be developed to create more loops inside loops
Sub CreateSimpleEmail()
Dim ol As Outlook.Application
Dim mi As Outlook.MailItem
Dim name As String
Dim hello As String
Dim title As String
Dim onemorerule As String
Dim emailbody As String
Dim i As Integer
emailbody = "Below are the rules"
For i = 3 To 6
onemorerule = Sheet1.Range("C" & i)
emailbody = emailbody & "<br>" & onemorerule
Next i
title = Sheet1.Range("B" & i)
Set ol = New Outlook.Application
Set mi = ol.CreateItem(olMailItem)
With mi
.To = "support@testabc.com"
.Subject = "test subject"
.BodyFormat = olFormatHTML
.HTMLBody = "<style> body{color:black;font-family:Arial;font-size: 12pt;} </style>" & _
"<HTML><body>Dear Team,<br><br> " & _
emailbody & "</body></html>"
.Display
End With
Set ol = Nothing
End Sub
No comments:
Post a Comment