Change order on generated e-mail

sxhall

Board Regular
Joined
Jan 5, 2005
Messages
246
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

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

Forum statistics

Threads
1,224,827
Messages
6,181,194
Members
453,021
Latest member
pingpong7117

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