Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hi I am copying data from Excel to

Status
Not open for further replies.

Palmcrest

Technical User
Jul 10, 2006
66
AU
Hi I am copying data from Excel to an email
I want to copy data from a range as an image and pop it into the email. This is working ok.
I also want to add some headings after the image in the body of the email. This also works ok.
BUT when I want copy the image to the email then add body headings under the image I can not seem to have both, only one or the other.

I am using the following code.
Code:
Sub Rprt()



'Copy range of interest
Dim r As Range

Set r = Range("A2:J69")
r.Copy

'Open a new mail item
Dim outlookApp As Outlook.Application
Set outlookApp = CreateObject("Outlook.Application")
Dim OutMail As Outlook.MailItem
Set OutMail = outlookApp.CreateItem(olMailItem)

'Get its Word editor
OutMail.Display
Dim wordDoc As Word.Document
Set wordDoc = OutMail.GetInspector.WordEditor

'To paste as picture
wordDoc.Range.PasteAndFormat wdChartPicture


    With OutMail
        .To = ""
        .CC = ""
        .BCC = ""
        .Subject = "Shut Execution Report"
        .HTMLBody = "<hr><h3>Safety</ht> <h5>(Details Here)</ht><h3>FRW</ht><h5>(Details Here)</ht> <h3>Critical Path</ht><h5>(Details Here)</ht> <h3>Emergent Work</ht><h5>(Details Here)</ht> <h3>General</ht><h5>(Details Here)</ht>"
                
        End With
       

End Sub

If I comment the paste picture I get the body text im after. But I want the pictue then the body text underneath.

any help would be appreciated.
 
Went down a different path - Saved image as temp file, referenced it and added it into the body text with HTML.
All worked good
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top