我正在使用Outlook脚本来转发使用特定模板的电子邮件。我在<img scr=
开始时添加徽标时遇到问题。
Public Sub FW(olItem As Outlook.MailItem)
Dim olForward As Outlook.MailItem
Set olForward = olItem.Forward
Set olLogo = Outlook.Application
If InStr(olItem.Subject, "AW:") Or InStr(olItem.Subject, "WG:") Or _
InStr(olItem.Subject, "Re:") Or InStr(olItem.Subject, "FW:") Or _
InStr(olItem.Subject, "Fwd:") Then
Stop
ElseIf InStr(olItem.Subject, "CH1") Or InStr(olItem.Subject, "CH3") Then
Const Path = "T:\TEMP\"
Const Logo = "image001.jpg"
With olForward & olLogo
.Attachments.Add Path & Logo
.Subject = olItem.Subject
.BodyFormat = olFormatHTML
.HTMLBody = "<span style=color:#1F497D;font-size:11pt;font-family:calibri;>" & _
"TEXT TUTAJ<BR><BR>" & _
"TEXT TUTAJ<BR><BR>" & _
"TEXT TUTAJ<BR>" & _
"TEXT TUTAJ<BR><BR>" & _
"<span style=color:#1F497D;font-size:9pt;font-family:arial;><b>" & _
"TEXT TUTAJ</b><BR>" & _
"TEXT TUTAJ<BR>" & _
"<html><img scr=cid:" & Replace(Logo, " ", "%20") & "height=55 width=170></html><BR>" & _
"TEXT TUTAJ"
.Display
.To = ""
.CC = ""
.Send
End With
End If
'// Clean up
Set olItem = Nothing
Set olForward = Nothing
Set olLogo = Nothing
End Sub
答案 0 :(得分:0)
想出来,应该看起来像这样。
Public Sub FW(olItem As Outlook.MailItem)
Dim olForward As Outlook.MailItem
Set olForward = olItem.Forward
If InStr(olItem.Subject, "AW:") Or InStr(olItem.Subject, "WG:") Or InStr(olItem.Subject, "Re:") Or _
InStr(olItem.Subject, "FW:") Or InStr(olItem.Subject, "Fwd:") Then
Stop
ElseIf InStr(olItem.Subject, "CH1") Or InStr(olItem.Subject, "CH3") Then
With olForward
.Attachments.Add "C:\TEMP\logo.jpg", olByValue, 0
.Subject = olItem.Subject
.BodyFormat = olFormatHTML
.HTMLBody = "<span style=color:#1F497D;font-size:11pt;font-family:calibri;>" & _
"TEXT TUTAJ<BR><BR>" & _
"TEXT TUTAJ<BR><BR>" & _
"TEXT TUTAJ<BR>" & _
"TEXT TUTAJ</span><BR><BR>" & _
"<span style=color:#000000;font-size:9pt;font-family:arial;>" & _
"<b>TEXT TUTAJ</b><BR>" & _
"TEXT TUTAJ<BR>" & _
"<img src='cid:logo.jpg'" & "width='170' height='55'><BR>" & _
"TEXT TUTAJ</span>"
.To = ""
.CC = ""
.Display
.Send
End With
End If
'// Clean up
Set olItem = Nothing
Set olForward = Nothing
End Sub
答案 1 :(得分:0)
看起来你缺少报价,以最简单的方式将它们加倍报价以处理报价。
以下示例
.HTMLBody = "<span style=color:#1F497D;font-size:11pt;font-family:calibri;>" & _
"TEXT TUTAJ<BR><BR>" & _
"TEXT TUTAJ<BR><BR>" & _
"TEXT TUTAJ<BR>" & _
"TEXT TUTAJ</span><BR><BR>" & _
"<span style=color:#000000;font-size:9pt;font-family:arial;>" & _
"<b>TEXT TUTAJ</b><BR>" & _
"TEXT TUTAJ<BR>" & _
"<img src=""cid:logo.jpg""" & "width=""170"" height=""55""><BR>" & _
"TEXT TUTAJ</span>"