I have the following VBA Code to create an E-Mail within an Excel spreadsheet:
Sub Test_EMail()
If ExitAll = False Then
Dim OApp As Object, OMail As Object, signature As String
Set OApp = CreateObject("Outlook.Application")
Set OMail = OApp.CreateItem(0)
With OMail
.Display
End With
signature = OMail.HTMLbody
With OMail
.To = "test@test.de"
.Subject = "test"
.HTMLbody = "<p> Hello </p>" _
& vbCr & "<p> I want to have a specific line hight because this </p>" _
& vbCr & "<p> line height is too much space </p>" _
& vbCr & "<p> How I can decrease this line height? </p>"
End With
Set OMail = Nothing
Set OApp = Nothing
Else
End If
End Sub
The code itself works perfectly. However, when I see the E-Mail there is a big line height between the three sentences written with HTML.
If I try to go with this:
& vbCr & <p style="line-height: 50%">I want to have a specific line hight because this</p>
it also does not work which might be due to the mixing of a VBA and HTML Code.
Do you have any idea how I can change the line height in the E-Mail within the VBA code?
Since this is an HTML format email, the HTML opening and closing tags must also be inserted.