Dear all,
I have been tackling this issue for a while now. I am trying to run some vba code from excel that opens a word file and uses its content as the body of an email (keeping the formating and pictures)
This is what I have right now:
Sub emailFromDoc2()
Dim wd As Object, editor As Object
Dim doc As Object
Dim oMail As Object
Set wd = CreateObject("Word.Application")
Set doc = wd.Documents.Open("C:\AutoFSAB\Word Files\Treated\2017-01-04 FSAB.docx")
doc.Content.Copy
Set oMail = CreateObject("Outlook.Application").CreateItem(MailItem)
With oMail
.Display
.BodyFormat = olFormatRichText
Set editor = .GetInspector.WordEditor
editor.Content.Paste
.Display
End With
End Sub
It should be working, but I always get an error 91 (Object Variable or With block variable not set) when it reaches the line: editor.Content.Paste
Any Ideas on how to solve this, or any alternatives to obtain the same result?
Kind Regards,
Andre
Bookmarks