我需要在邮箱正文(Line1
)的同一行连接变量字符串str
.
我试图在字符串中添加&str
,但输出结果只有&str,而不是str的值.
另外,如果我在</p>"
之后添加,那么它会将str的值添加到下一行.
请告诉我如何解决此问题?
Sub Send_Email()
Dim objOutlookApp As New Outlook.Application
Dim myEmail As Outlook.MailItem
Set myEmail = objOutlookApp.CreateItem(olMailItem)
myEmail.BodyFormat = olFormatHTML
myEmail.Display
'___________________
Dim str As String: str = "My Text"
Dim Strbody As String
Dim Style As String: Style = "<p style=font-size:12.5pt;font-family:Georgia>"
Dim Line1 As String: Line1 = "   Attached file contains </p>" & str 'this add str on the next line
Strbody = Style & Line1
myEmail.HTMLBody = Strbody & myEmail.HTMLBody
End Sub