如何在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`
提前致谢
- HTML到电子表格文件
- 如何在Excel中使用Excelreplace<*>如在Excel中? (常用expression)
- 使用Microsoft Excel VBA,你可以访问另一张表吗?
- 在Windows的Excel VBA中,如何缓解由IDE的大小写行为破坏的parsingJSON的点语法遍历问题?
- 如何部署vsto excel解决scheme,使pipe理员权限不被要求安装和使用?
- 在特定的工作表上打开Excel文件
- 得到“下标超出范围”的错误,我不知道什么是错的。 (我对vba是新鲜的)
- 在工作簿中的所有工作表中运行我的macros
- 每当有另一个excel打开时,无法closures我的excel