把定义outlook变量的代码改为1楼的用法,其他代码照抄就行了
Dim OLAPP As New Microsoft.Office.Interop.Outlook.Application
Dim olmail As Microsoft.Office.Interop.Outlook.MailItem
olmail = OLAPP .CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem)
OLT = "<tabel class = MsotableGrid border = 1 cellspacing =0 cellpadding =0 style ='border-collapse:border:none:mso-border-alt:solid windowstext.5pt:mso-yfti-tbl ollk:1184:mso-padding-alt:0IN 5.4PT Oin 5.4pt'>"
For TableRow = 2 To 22
OLT = OLT & "<tr style = ' mso-yfti-irow:0:mso-yfti-firstrow:yes:height:.2in'>"
For Tablecolumn = 1 To 14
OLT = OLT & " <td width=65 nowrap valign=top style='width:125pt;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .5pt;padding:0in 5.4pt 0in 5.4pt;height:.2in'><p class=MsoNormal>" & "<font face=""Calibri"" size=""3"" color=""black"">" & Cells(TableRow, Tablecolumn) & " <o:p></o:p></p></td>"
Next
OLT = OLT & " </tr>"
Next
OLT = OLT & "</table>"
With olmail
.TO = "11@XX.COM"
.CC = ""
.BCC " """
.Subject = "XX"
.hTMLBODY = "hI , <br><br> " & OLT & "<br><br> yy "
End With