Hello,
The Outlook VBA code below paste into the body of an email the content of some cells in the excel sheet "example.xlsx".
I would like the content of the excel sheet to be pasted as paste special "Unformatted Unicode Text" in the outlook email.
I have found on google that the command wdFormatPlainText should be used and I have tried to implement it in the code below but it doesn't work, the content of the excel cells still gets copied with formatting.
Sub CopyFromExcel()
Dim myXL As Excel.Application
Dim wb As Excel.Workbook
Dim myMail As MailItem
Set myXL = GetObject(, "Excel.Application")
Set wb = myXL.Workbooks("example.xls")
wb.RefreshAll
wb.Worksheets(1).Range("A1:A102").Copy
Set myMail = ThisOutlookSession.CreateItem(olMailItem)
With myMail
.Display
'.GetInspector.WordEditor.Range.Paste 'Original code pasting with formatting
.GetInspector.WordEditor.Range.PasteAndFormat wdFormatPlainText 'code supposed to paste without formatting - not working as formatting still there
.To = "emailAddress"
.Display
'.Send
End With
End Sub
Could someone explain how I can paste the content of the excel cells with the paste special "unformatted unicode text" option?
Thank you very much.