VBA Email with pasted chart and body text

The purpose of the following code is to insert the selected diagram into the body of the letter under my text. However, he continues to embed it on top of my text. How can I change it to fit below? Thank!

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
+6
source share
2 answers

Change the start and end of the selection. Adding extra line breaks might also be a good idea. You should also use MailItem.GetInspector instead of Application.ActiveInspector as the message is not yet displayed.

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
+9
source

, , , , 4605; " ,

, -

-1

All Articles