Fancy Outlook Email

Geoff Taylor

Active Member
Joined
Dec 11, 2006
Messages
257
Hi
I have some code that passes data from individual cells Excel rows into an email and sends them to individual recipients. It works fine.

However, the emails don't look pretty and it's been decided that they must do so (logos, typefaces etc). I have no idea how to approach this. Would I need to start passing HTML code to Outlook or can I create some kind of template in Outlook that the Excel VBA could reference?

All contributions gratefully received.

<code>
'Get confirmation
Dim Response
Response = MsgBox("You are about to create and send several hundred emails. Are you sure?", vbYesNo)
If Response = vbNo Then Exit Sub

'Declare Variables
Dim ol As Outlook.Application
Dim olMail As MailItem
Dim sRecipient As String
Dim rMyCell As Range
Dim sMyFollowup As String


'This bit tells the macro where to find the email address
For Each rMyCell In Range("B12:B" & Range("B11").End(xlDown).Row)

sMyFollowup = ""
If Range("N" & rMyCell.Row).Value = "Yes" Then
sMyFollowup = Range("followup").Value
End If

'Create an Outlook session
Set ol = CreateObject("outlook.application")
Set olMail = ol.CreateItem(olMailItem)
sRecipient = Range("E" & rMyCell.Row).Value
olMail.to = sRecipient
olMail.Subject = Range("myheading").Value
olMail.Body = Range("Body1").Value & " " & Range("I" & rMyCell.Row).Value & Chr(10) & Range("Body2").Value & " " & Range("M" & rMyCell.Row).Value & Chr(10) & sMyFollowup & Chr(10) & Range("Body3").Value
olMail.Importance = olNormal
olMail.Sensitivity = olNormal
olMail.Send

Next
End Sub
</code>
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney

Forum statistics

Threads
1,224,618
Messages
6,179,916
Members
452,949
Latest member
beartooth91

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