我有一个带有VBA代码的excel文件,该文件可以发送带有表格的自动邮件作为图片。使用当前代码,此功能在办公室64bit
中不起作用。我该如何更改代码才能使用该功能?
Sub Send_Dashboard_image() 'image not clear
Dim oApp As Object
Set oApp = CreateObject("Outlook.Application")
Dim oMail As Object
Set oMail = oApp.CreateItem(olMailItem)
Dim rng As Range
Set rng = Range("I1:Z71")
rng.CopyPicture xlPrinter
Dim chartObj As ChartObject
Set chartObj = Sheets("CA_list").ChartObjects.Add(0, 0, rng.Width, rng.Height)
chartObj.Select
chartObj.Chart.Paste
chartObj.Chart.Export ThisWorkbook.Path & "\table.png", "png"
chartObj.Delete
Dim strbody As String
With oMail
.Subject = “Internal Audit dashboard FY " & Sheets("Dashboard - Internal").Range("AK7").Value & ""
strbody = "<BODY style='font-size:12pt;font-family: Calibri’>" & "Hi All,<br><br>Below you can see the dashboard of Internal audits ".& "</BODY>"
strbody = strbody & "<br><img src='cid:table.png'/>" 'height=1440 width=1080
Dim wordDoc As Object
Set wordDoc = oMail.GetInspector.WordEditor
.Attachments.Add ThisWorkbook.Path & "\table.png", 1, 0
.HTMLBody = strbody
.Display
End With
End Sub