Document Content to Body of Email


Board Regular
Good morning,

Hoping all you wonderful folks out there can help me, I am trying to find a vba script to open a word document and copy the contents and create a new email message and use the document contents as the email body, is this possible using vba?



Board Regular
The email is an escalation email and they just want the content of the word template inserting into the body of the email if that makes sense


Board Regular
Formatting in Outlook does have most the same elements as Word but not all.
Why not Share the Word document by Email?
Formatting in Outlook does have most the same elements as Word but not all.
Why not Share the Word document by Email?
I have found the following which seems to work but if it is ran more than once i.e in a loop until all escalations have been dealt with then the 2nd time round I get a runtime error saying the document is locked for editing and cant figure out why?

Set oWordApp = CreateObject("Word.Application")
Set oWordDoc = oWordApp.Documents.Open("C:\Temp\Reminder.docx", ReadOnly:=True)

Set oOutApp = CreateObject("Outlook.Application")
Set oMailItem = oOutApp.CreateItem(0)

With oMailItem
.To = ""
.Subject = "Level 2 On Hold Escalation Email"
End With

Set oMailWordDoc = oOutApp.ActiveInspector.WordEditor


Set oMailItem = Nothing
Set oMailWordDoc = Nothing
Set oOutApp = Nothing


Well-known Member
If the content is static and just written up in a Word Document, it might be simpler to make that text an Auto Text or Quick Part.

As far as the error in the loop, it appears it is trying to re-open the Word document. Open the Word document before the Loop and make sure you .Close the document before the procedure finishes. Having to Open/Close it will slow it down if you have a lot of loop executions.

Some videos you may like

This Week's Hot Topics

  • Get External Data (long shot question!)
    This is likely a long shot but I am wondering if it is at all possible for Excel to somehow 'change' the contents of a URL that is being linked to...
  • Importing multiple excel files into one spreadsheet
    Hi, I'm trying to import multiple excel files (with the same format into a single spreadsheet) so that each day's file is listed underneath the...
  • Cell Formatting
    Good Morning, I need to format a few different cells in the following manners: A1 has to always add a colon (:) after whatever is typed in by a...
  • How to copy multiple rows using If
    Hi all, I'm very new to VBA and have written this simple code to copy certain cells if a certain cell within that row contains any data. I need...
  • Workbook_Change stopped working !
    I am working on an app to speed up & automate processing of Credit Cards statements. After data is input from a CSV file, it is presented to the...
  • VBA If statement
    Dear All, I have two dates, where I'd like a message box to pop, if the dates are between this criteria. [CODE] sDate1 = #10/1/2019#...