以下代码的目标是将选定的图表粘贴到下面我的文本中的电子邮件正文中。但是,它会继续将其粘贴到我的文本上方。如何更改它以使其粘贴在下面?谢谢!
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
With OutMail
.CC = "xyz@anc.com"
.BCC = "abc@xyz.com"
.Subject = "Test"
.Body = "Dear" & "Macro "
ActiveSheet.Range("P36:X46").Copy
Set wEditor = OutApp.ActiveInspector.WordEditor
wEditor.Application.Selection.Paste
.display
答案 0 :(得分:9)
更改选择的开始和结束。添加额外的换行符也可能是一个好主意。您还应该使用MailItem.GetInspector而不是Application.ActiveInspector,因为消息尚未显示。
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
With OutMail
.CC = "xyz@anc.com"
.BCC = "abc@xyz.com"
.Subject = "Test"
.Body = "Dear" & "Macro " & vbCrLf
ActiveSheet.Range("P36:X46").Copy
set vInspector = OutMail.GetInspector
Set wEditor = vInspector.WordEditor
wEditor.Application.Selection.Start = Len(.Body)
wEditor.Application.Selection.End = wEditor.Application.Selection.Start
wEditor.Application.Selection.Paste
.display