Change order on generated e-mail

sxhall

Board Regular
Joined
Jan 5, 2005
Messages
237
Office Version
  1. 365
Platform
  1. Windows
Hi,

The below is part of a larger macro than generates an e-mail with an image from an Excel sheet as well as some text and the file as an attachment.

VBA Code:
Set OutMail = OutApp.CreateItem(0)
    With OutMail
        Set olInsp = .GetInspector
        Set wdDoc = olInsp.WordEditor
        Set oRng = wdDoc.Range
        .BodyFormat = 2
        .To = sTo
        .CC = sTo2
        .BCC = ""
        .Subject = "Scan Report - " & Format(Now(), "dd/mm/yy")
        .Body = "All," & vbCr & vbCr & "Please find attached to this email the 'Scan Report' for the " _
        & Format(Now(), "dd/mm/yy") & "." & vbCr & vbCr & "Regards" & vbCr & vbCr & Myname
        oRng.collapse 1
        oRng.Paste
        .Attachments.Add ActiveWorkbook.FullName
        .Display
    End With

What I need to do is have the image after the text! I have tried reordering hte above but it then does not add the .Body part of the code or the image.

Any help with how to have the e-mail format as the .Body part first and then the oRng.Paste after would be appreciated.

Thanks in advance

Steven
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop

Forum statistics

Threads
1,223,911
Messages
6,175,324
Members
452,635
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top