如何在HTML正文中插入Excel表格并通过Gmail发送

我pipe理创build一个通过使用VBA代码通过Gmail发送电子邮件的代码。 我的下一步是在HTML主体中插入一个范围。 你能帮我吗?

代码:

Sub Send_mail() Dim myMail As CDO.Message Set myMail = New CDO.Message myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com" myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465 myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "xxxx@xxxx.com" myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "xxxxx" myMail.Configuration.Fields.Update Dim strHTML strHTML = "<HTML>" strHTML = strHTML & "<HEAD>" strHTML = strHTML & "<BODY>" strHTML = strHTML & "<b> This is the test HTML message body</b></br>" strHTML = strHTML & "</BODY>" strHTML = strHTML & "</HTML>" With myMail .Subject = "Position Match Check " & Now() .From = "xxxx@xxxx.com" .To = "xxxxk@xxxx.eu" .TextBody = "" .HTMLBody = strHTML End With On Error Resume Next myMail.Send MsgBox ("Mail Sent") Set myMail = Nothing End Sub 

我想添加到HTML主体的范围:

 `Dim r As Range Set r = Range("B6:J88") r.Copy Dim p As Picture Set p = ActiveSheet.Pictures.Paste p.Cut` 

提前致谢