Kirbtheman
Kirbtheman

Reputation: 21

VBA - Outlook Email.HTMLBody Line spacing?

his is a small problem but is confusing me. I am automating an email to be sent from excel. The below code, for some reason, makes the last line have larger than normal spacing:

Sub emailspacing()
Dim OutApp As Object
Dim OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
With OutMail
    .HTMLBody = "<p style='font-family:calibri;font-size:14.5'>Thanks for your help</p>"
    .display
End With

Whereas, when I remove the P style part, the email is generated with perfect line spacing???

Sub emailspacing()
Dim OutApp As Object
Dim OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
With OutMail
    .HTMLBody = "Thanks for your help"
    .display
End With

Does anyone know a way to combine the stylised HTML text with normal line spacing?

Upvotes: 1

Views: 11644

Answers (1)

Kirbtheman
Kirbtheman

Reputation: 21

Cracked it! This needed to be added to the p style:

margin-bottom:.0001pt;

Upvotes: 1

Related Questions