jtsbattle
jtsbattle

Reputation: 185

Draw vertical border line in HTML email using VBA

I am using a VBA userform from which a user can send an email.

How do I create a vertical orange line as shown below?
enter image description here

In HTML, it would be something like this:

style="border-left: solid 4px #FF6801;">

Edit: answer based on Tim's answer:

Dim ol As Outlook.Application, m As Outlook.MailItem

Set ol = New Outlook.Application
        
Set m = ol.CreateItem(olMailItem)
m.Display
m.BodyFormat = olFormatHTML
        
m.HTMLBody = "<p style='border-left: solid 4px #FF6801;padding: 24px;margin-left:24px;'>" & VariableName.Value & "</p>" 

Upvotes: 0

Views: 637

Answers (1)

Tim Williams
Tim Williams

Reputation: 166970

This works for me:

Dim ol As Outlook.Application, m As Outlook.MailItem

Set ol = New Outlook.Application
        
Set m = ol.CreateItem(olMailItem)
m.Display
m.BodyFormat = olFormatHTML
        
m.HTMLBody = "<p>No border</p>" & _
             "<p style='border-left: solid 4px #FF6801;'>With border</p>" & _
             "<p>No border</p>"

Upvotes: 1

Related Questions