logo
search
VBA & Macro Problems

How to Open and Send an Outlook Email Template from a Word VBA Macro

Camila MilosovichCamila Milosovich Oct 19, 2026 868 views

Question details

The user needs to trigger and send a pre-formatted Outlook email template directly from a Word document using a VBA macro, avoiding the issue of the template opening inside Word.

How to Open and Send an Outlook Email Template using Word VBA
Product
Microsoft Word
Device & OS
not provided
Scenario
Automating outgoing email generation from a Word document by utilizing a saved Outlook template.
Observed behavior
Instead of opening a .msg file in Word, the user wants the macro to properly launch Outlook, create the email from an .oft file, and send it to the designated recipients.
Before you start

Ensure you have Microsoft Outlook installed and configured with an active email account on your computer, and verify that you have saved your desired email layout as an Outlook Template (.oft) file.

Solution 1Recommended

Automate Outlook using the CreateItemFromTemplate Method in Word VBA

Use a VBA script in Word to bind to the Outlook application, create a new email item from an .oft template file, and send it automatically.

To properly automate Outlook from Word, you must use an Outlook Template (.oft) file rather than a standard saved message (.msg) file. The .oft format is designed specifically for creating new, reusable items.

The following solution uses Late Binding, meaning you do not need to manually add the Microsoft Outlook Object Library reference in your Word VBA editor. The macro will automatically check if Outlook is running, start it if necessary, and close it when finished if it was started in the background.

1
Save your email template

In Outlook, create a new email, format it as desired, and go to File > Save As. Choose 'Outlook Template (*.oft)' from the dropdown and save it to a known directory (e.g., C:\Templates\[TemplateName].oft).

2
Open the VBA Editor in Word

Open your Microsoft Word document and press Alt + F11 to launch the Visual Basic for Applications (VBA) editor. Go to Insert > Module to create a new blank module.

3
Insert the Outlook automation code

Copy and paste the following script into the module: Dim oOutlookApp As Object Dim oItem As Object Dim bStarted As Boolean On Error Resume Next Set oOutlookApp = GetObject(, "Outlook.Application") If Err <> 0 Then Set oOutlookApp = CreateObject("Outlook.Application") bStarted = True End If On Error GoTo 0 Set oItem = oOutlookApp.CreateItemFromTemplate("C:\Templates\[TemplateName].oft") With oItem .Recipients.Add "email@example.com" .Subject = "Subject Text" .Send End With Set oItem = Nothing If bStarted = True Then oOutlookApp.Quit End If Set oOutlookApp = Nothing

4
Customize the file path and email details

In the pasted code, replace 'C:\Templates\[TemplateName].oft' with the actual file path of your template. Update 'email@example.com' and 'Subject Text' with your intended recipient and subject line.

5
Run the macro

Press F5 while inside the module window, or return to Word, navigate to the Developer tab, click Macros, select your new macro, and click Run.

Automate Outlook using the CreateItemFromTemplate Method in Word VBA
Previewing before sending: If you want to review the email before it sends, replace the '.Send' command in the script with '.Display'. This will open the email window on your screen so you can manually click the Send button.

Automate Document Workflows with WPS Office

WPS Office provides robust macro capabilities in its advanced editions, allowing you to run VBA scripts and automate repetitive tasks across your documents with excellent format compatibility.

  1. 1. Install WPS Office: Download and install the latest version of WPS Office from the official website.
  2. 2. Open your macro-enabled document: Launch WPS Writer and open your .docm or .doc file containing the automation scripts.
  3. 3. Access the Developer tab: Navigate to the Developer tab in the ribbon to access the built-in Macro editor and manage your VBA code.
  4. 4. Run your scripts: Select the required macro from the list and click Run to execute your automated workflow.
Highly compatible with Microsoft Word document formats (.doc, .docx, .docm)Supports advanced macro scripting for complex document automationLightweight, fast, and features a familiar tabbed interfaceFree to use for basic daily office tasks
microsoft office alternative - wps office

Frequently Asked Questions

Why does my macro try to open the email directly inside Word?

This usually happens if you attempt to open an Outlook message (.msg) file using Word's native document open commands. To integrate with Outlook, you must use an Outlook Template (.oft) file and automate the Outlook application via VBA to handle the file.

Do I need to enable any specific object libraries in Word VBA?

Not if you use 'Late Binding'. By declaring your variables as generic Objects and using the CreateObject function (as shown in the recommended solution), you avoid the need to manually enable the Microsoft Outlook Object Library in the VBA editor references.

Can I add attachments to the email template using this macro?

Yes. Inside the 'With oItem' block of your VBA script, you can add a line like '.Attachments.Add "C:\path\to\your\file.pdf"' before the '.Send' command to automatically attach files to the generated email.