在html

时间:2018-01-26 14:09:36

标签: html vba outlook

场景:我正试图干涉将与VBA一起发送的电子邮件的输出。我正在尝试添加背景图片和一段文字。

问题:图像部分工作正常,但我无法将文本分成3行。

Obs:我的生活中从未使用过HTML,但显然这是用VBA更改电子邮件背景的唯一方法。我尝试在网上寻找答案,但我得到的最好的是使用<br>这对我不起作用。

问题:这样做的正确方法是什么?

代码:

Private Sub mailer2()
Dim oApp, oMail As Object, MyHTML As String, WB As Workbook, FileName As String, BodyText As String, MyText As String, MyText2 As String, MyText3 As String
Dim username As String

    Application.ScreenUpdating = False

    Set oApp = CreateObject("Outlook.Application")
    Set oMail = oApp.CreateItem(0)

    username = InputBox("Please write your E-mail")

    MyText = "Greetings"
    MyText2 = "Your Macro.V.0.4 has concluded."
    MyText = "Please attend to terminal AFAP"


    MyHTML = vbCrLf & "<p style=""font-size:18px;font-weight:Bold;color:rgb(100,100,100)"">" & MyText1 & "<br>" & MyText2 & "<br>" & MyText3 & "</p>"

    'this next works, but puts everything into a single line
    'MyHTML = MyHTML & vbCrLf & "<p style=""font-size:19px;font-weight:Bold;color:rgb(100,100,100)"">" & MyText & "</p>"

    With oMail
        .To = username
        .Subject = "Automated message, please do not answer"
        .HTMLBody = MyHTML
        .Send
    End With

    Application.ScreenUpdating = True
    Set oMail = Nothing
    Set oApp = Nothing

End Sub

2 个答案:

答案 0 :(得分:1)

除了brax所说的(<br>)之外,您可以使用水平规则标记<hr>。 将其中任何一个放在要分割的文本之间。

编辑:尝试删除&#34; &#34;你的HTML。没有这些标签就可以使用。

EDIT2:没关系我的第一次编辑,我误读了你的代码。试试<br><br>。它应该工作。

一般来说,你的问题非常基本。下次尝试在发帖之前再挖一些。回答这样的问题很容易。

答案 1 :(得分:0)

您可以使用HTML进行换行:

FROM nginx:1.13
COPY  dist/ /usr/share/nginx/html
COPY ./nginx-custom.conf /etc/nginx/conf.d/default.conf