Hi all,
I have the below coding to send an email with a screen shot of excel attached, but it is losing the formating when pasting into the email body, please can you help.
I have the below coding to send an email with a screen shot of excel attached, but it is losing the formating when pasting into the email body, please can you help.
VBA Code:
Application.ScreenUpdating = False
'Declare Outlook Variables
Dim oLookApp As Outlook.Application
Dim oLookItm As Outlook.MailItem
Dim oLookIns As Outlook.Inspector
Dim Subject As String
Dim DistrlistMain As String
'Declare Word Variables
Dim oWrdDoc As Word.Document
Dim oWrdRng As Word.Range
'Delcare Excel Variables
Dim ExcShrinkRange As Range
On Error Resume Next
'Get the Active instance of Outlook if there is one
Set oLookApp = GetObject(, "Outlook.Application")
'If Outlook isn't open then create a new instance of Outlook
If Err.Number = 429 Then
'Clear Error
Err.Clear
'Create a new instance of Outlook
Set oLookApp = New Outlook.Application
End If
'Create a new email
Set oLookItm = oLookApp.CreateItem(olMailItem)
'Create an array to hold ranges
Set ExcShrinkRange = Sheet1.Range("Range")
With oLookItm
Subject = Sheet1.Range("V2").Value
DistrlistMain = Sheet1.Range("U2").Value
'Define some basic info of our email
.SentOnBehalfOfName = "Email address"
.To = DistrlistMain
.Subject = Subject
.Body = ""
'Display the email
.Display
'Get the Active Inspector
Set oLookIns = .GetInspector
'Get the document within the inspector
Set oWrdDoc = oLookIns.WordEditor
'get range
Set oWrdRng = oWrdDoc.Application.ActiveDocument.Content
oWrdRng.Collapse Direction:=wdCollapseEnd
'copy range
ExcShrinkRange.Copy
oWrdRng.PasteSpecial ppPastePNG
.Display
Application.ScreenUpdating = True
End With
End Sub