使用Excel VBA创build的电子邮件(HTML)中的行高

我有以下VBA代码在Excel电子表格中创build一个电子邮件:

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 

代码本身工作完美。 但是,当我看到电子邮件时,用HTML编写的三个句子之间有一个很大的高度。

如果我试着去这样做:

 & vbCr & <p style="line-height: 50%">I want to have a specific line hight because this</p> 

它也不起作用,这可能是由于混合了VBA和HTML代码。

你有什么想法如何在VBA代码中改变电子邮件的行高?

由于这是一个HTML格式的电子邮件,因此还必须插入HTML开始和结束标记。

 Dim body_ As String body_= "<p> Hello </p>" _ & "<p> I want to have a specific line hight because this </p>" _ & "<p> line height is too much space </p>" _ & "<p> How I can decrease this line height? </p>" .BodyFormat = olFormatHTML .HTMLBody = "<html><head></head><body>" & body_ & "</body></html>"