本文介绍了需要通过VB宏在活动工作簿的电子邮件中插入图形/图表.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是subash,创建了一个宏,该宏会自动发送带有图表中更新数据的电子邮件.在这里,我无法在电子邮件正文或附件中插入图表.请帮我解决这个问题.
SBC.xlsm工作表有两个图表.我需要同时附上. ppls帮助它非常紧急.
Hi am subash, creating an macro with automatically send email with the updated data in chart.. here i cant insert chart in email body or attachment. pls help me to fix this.
SBC.xlsm sheets has two charts. i need to attach both. ppls help its very urgent.
Sub Macro1()
'
' Macro1 Macro
'
'
ChDir "D:\SBC"
Workbooks.OpenText Filename:="D:\SBC\SBC.txt", Origin:=437, StartRow:=1, _
DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter _
:=False, Tab:=False, Semicolon:=False, Comma:=False, Space:=False, _
Other:=True, OtherChar:=":", FieldInfo:=Array(Array(1, 1), Array(2, 1)), _
TrailingMinusNumbers:=True
Cells.Select
Cells.EntireColumn.AutoFit
Range("F8").Select
Workbooks.Open Filename:="D:\SBC\SBC.xlsm", Origin:=xlWindows
Range("B12").Select
Sheets("SBC").Select
Range("H61").Select
ActiveWindow.SmallScroll Down:=-81
Windows("SBC.txt").Activate
ActiveWindow.SmallScroll Down:=-15
Columns("A:B").Select
Selection.Copy
Windows("SBC.xlsm").Activate
Columns("A:B").Select
ActiveSheet.Paste
Range("D5:D6").Select
Application.CutCopyMode = False
ActiveWorkbook.Save
Windows("SBC.xlsm").Activate
Call auto_email
Workbooks(sbc).SaveAs ("sbc report" + Format(Now, "dd-mm-yyyy hh:mm:ss"))
Workbooks(book1).Activate
Workbooks(book1).Close
End Sub
Private Sub auto_email()
Set myOutlook = CreateObject("Outlook.Application")
Set mymail = myOutlook.CreateItem(olMailItem)
mymail.Display
mymail.Subject = "Automated SBC report" + Format(Now, "dd-mm-yyyy hh:mm:ss")
mymail.HTMLbody = ActiveSheet.ChartObjects("Chart 1").Add
mymail.To = "[email protected]"
mymail.Display
End Sub
推荐答案
这篇关于需要通过VB宏在活动工作簿的电子邮件中插入图形/图表.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!