我正在尝试使用CSS和HTML表格在HTML中发送电子邮件Outlook,但我收到一个错误:第33行溢出。我的旧脚本没有HTML,现在我想用HTML发送。你能帮我解决一下吗?
见下面我的代码:
Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8
Const FileToBeUsed = "C:\link of my file"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.GetFile("C:\link of my file")
If objFile.Size > 0 Then
Dim objCDO1, objCDO2
Dim fso, f
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile(FileToBeUsed, ForReading)
Set objCDO1 = CreateObject("CDO.Message")
'objCDO1.Textbody = "See the details of the file ."&VbNewLine+vbnewline+vbnewline&"No more details"
'objCDO1.Textbody = f.ReadAll
strFileText = f.ReadAll
f.Close
arrFileText = Split(strFileText, vbCrLF) 'split the file content by line feed character
For intArrCounter = 0 To UBound(arrFileText)
ArrLineContent = Split(arrFileText(intArrCounter), "|")
Code = ArrLineContent(0)
Operator = ArrLineContent(1)
CLIENT = ArrLineContent(2)
MONTANT = ArrLineContent(3)
CIN = ArrLineContent(4)
NOM = ArrLineContent(5)
PERIODE = ArrLineContent(6)
HEURE = ArrLineContent(7)
Dim cdohtml
cdohtml= "<HTML>"&_
"<style type="&text/css&">"&_
".tg {border-collapse:collapse;border-spacing:0;}"&_
".tg td{font-family:Arial, sans-serif;font-size:14px;padding:10px 5px;border-style:solid;border-width:0px;overflow:hidden;word-break:normal;border-top-width:1px;border-bottom-width:1px;}"&_
".tg th{font-family:Arial, sans-serif;font-size:14px;font-weight:normal;padding:10px 5px;border-style:solid;border-width:0px;overflow:hidden;word-break:normal;border-top-width:1px;border-bottom-width:1px;}"&_
".tg .tg-4cee{background-color:#d91717;color:#000000;text-align:center}"&_
".tg .tg-g1w4{font-size:large;background-color:#d91717;color:#000000}"&_
"</style>"&_
"<table class="&tg&" style="&undefined&";table-layout: fixed; width: 337px">""&_
"<colgroup>"&_
"<col style="&width&"&: 156px&">""&_
"<col style="&width&"&: 181px&">""&_
"</colgroup>"&_
"<tr>"&_
"<td class="&tg-g1w4&">Numéro Bordereau</td>"&_
"<td class="&tg&"&-4cee&">" & Code & ""</td>"&_
"</tr>"&_
"<tr>"&_
"<td class="&tg-g1w4&">Opération</td>"&_
"<td class="&tg&"&-4cee&">" & Operator & ""</td>"&_
"</tr>"&_
"<tr>"&_
"<td class="&tg-g1w4&">Client</td>"&_
"<td class="&tg&"&-4cee&">" & CLIENT & ""</td>"&_
"</tr>"&_
"<tr>"&_
"<td class="&tg-g1w4&">Montant</td>"&_
"<td class="&tg&"&-4cee&">" & Code & ""</td>"&_
"</tr>"&_
"<tr>"&_
"<td class="&tg-g1w4&">CIN</td>"&_
"<td class="&tg&"&-4cee&">" & CIN & ""</td>"&_
"</tr>"&_
"<tr>"&_
"<td class="&tg-g1w4&">Nom Porteur</td>"&_
"<td class="&tg&"&-4cee&">" & NOM & ""</td>"&_
"</tr>"&_
"<tr>"&_
"<td class="&tg-g1w4&">Date</td>"&_
"<td class="&tg&"&-4cee&">" & PERIODE & ""</td>"&_
"</tr>"&_
"<tr>"&_
"<td class="&tg-g1w4&">Heure</td>"&_
"<td class="&tg&"&-4cee&">" & HEURE & ""</td>"&_
"</tr>"&_
"</table>"&_
"</HTML>"
objCDO1.HtmlBody = cdohtml
'objCDO1.AddAttachment("C:\link of my file")
objCDO1.To ="adr1@.com"
objCDO1.From = "adr2@.com (CCP Stored Procedure Message)"
objCDO1.Subject = "CCP Stored Procedure"
objCDO1.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objCDO1.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mysmtp"
objCDO1.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration /smtpserverport") = 25
objCDO1.Configuration.Fields.Update
'objCDO1.HTMLBody="Image <img src='C:\link of image\ENTETE.png'>"
objCDO1.Send
Next
Set cdohtml = Nothing
Set objCDO1 = Nothing
Set f = Nothing
Set fso = Nothing
Else
WScript.Echo "no file"
End If