You can send an Outlook email from Excel VBA using a saved Outlook template by creating an Outlook Application object, opening the template with CreateItemFromTemplate, filling in the To, CC, Subject and body fields, and calling Send or Display. This is useful for sending the same formatted message to many recipients with data from your spreadsheet, such as invoices, reminders or reports. You need Excel with the VBA editor, Outlook installed and configured with an email account, and a saved Outlook template (.oft) file. The steps below work on Windows desktop versions of Excel and Outlook; Mac Excel does not support the same Outlook automation.
What You'll Need
- Microsoft Excel (Windows desktop version) with the Developer tab enabled.
- Microsoft Outlook (Windows desktop version) signed in to a configured email account.
- A saved Outlook template file (.oft). You create this in Outlook: compose a new email, then use File > Save As and choose Outlook Template (*.oft).
- Basic familiarity with the VBA editor (Alt+F11).
- Recipient email addresses in your worksheet, for example in column A.
Step-by-Step
- Create and save your Outlook template. In Outlook, start a new email, add the subject, body text and any formatting or images you want. Do not add recipients yet unless they are always the same. Then choose File > Save As, set the file type to Outlook Template (*.oft), and save it to a folder you can find easily, such as Documents\Templates. Note the full path.
- Prepare your Excel data. Put the recipient addresses in one column, starting at row 2, with a header in row 1. If you want personalised fields, add columns for names or other details. Save the workbook as a macro-enabled file (.xlsm).
- Open the VBA editor. Press Alt+F11. In the Project Explorer, right-click your workbook and choose Insert > Module. A blank code window appears.
- Add the macro. Paste a procedure that declares Outlook objects, opens the template, sets the fields and sends. A minimal working example:
Sub SendFromTemplate()
Dim olApp As Object
Dim olMail As Object
Dim ws As Worksheet
Dim lastRow As Long, i As Long
Dim tplPath As String
tplPath = "C:\\Users\\YourName\\Documents\\Templates\\MyTemplate.oft"
Set ws = ThisWorkbook.Sheets("Sheet1")
lastRow = ws.Cells(ws.Rows.Count, "A").End(xlUp).Row
Set olApp = CreateObject("Outlook.Application")
For i = 2 To lastRow
Set olMail = olApp.CreateItemFromTemplate(tplPath)
With olMail
.To = ws.Cells(i, "A").Value
.Subject = "Your subject here"
.HTMLBody = "Hello,
" & ws.Cells(i, "B").Value & "
" & .HTMLBody
.Display ' use .Send to send automatically
End With
Set olMail = Nothing
Next i
Set olApp = Nothing
End Sub- Adjust the template path and column letters. Replace the path with the actual location of your .oft file. Change column A to whichever column holds the addresses, and column B to your personalisation column. Note that setting
.HTMLBodyreplaces the template body; to keep the template formatting and add text, insert your text before the existing HTML as shown, or use.Bodyfor plain text. - Run the macro. Press F5 in the editor or run it from Developer > Macros in Excel. Using
.Displayopens each email for review; using.Sendsends immediately. Test with a small list first. - Handle Outlook security prompts. Outlook may show a warning that a program is trying to send email on your behalf. Click Allow. If your organisation blocks programmatic sending, the macro will fail and you will need to use
.Displayand send manually, or ask your IT administrator about approved automation. - Release objects and clean up. The code sets objects to Nothing at the end. If you loop over many rows, consider adding a short delay or sending in batches to avoid overwhelming Outlook.
Common Mistakes
- Using the wrong file path for the .oft file, especially with spaces or network drives. Use the full path and double-check it.
- Saving the workbook as .xlsx instead of .xlsm, which strips the macro.
- Overwriting the template body entirely with
.HTMLBody = ...instead of appending to it. - Forgetting that
.Sendsends without review; test with.Displayfirst. - Leaving Outlook closed. Outlook must be running or startable for automation to work.
- Using Mac Excel, which does not support this Outlook automation in the same way.
Tips
- Store the template path in a cell or a constant at the top of the module so it is easy to change.
- Use
On Error Resume Nextsparingly; instead, check that the template file exists withDir()before opening. - Add a column for CC or BCC and set
.CCor.BCCin the loop if needed. - If you want to personalise the subject, set
.Subjectinside the loop using worksheet values. - Keep a copy of the template in a local folder rather than a synced cloud folder to avoid path issues.
Troubleshooting
If the macro stops with a "file not found" error, verify the template path and that the .oft file still exists. If Outlook does not open, make sure it is installed and signed in. If you get a permission or security warning, allow the action; if your organisation blocks it, use .Display and send manually. If the email body looks wrong, check whether you are appending to .HTMLBody or replacing it. If nothing happens, step through the code with F8 to see which line fails. If the macro runs but no email appears, confirm that the recipient column is not empty and that the loop range is correct.
Frequently Asked Questions
Can I send to multiple recipients from one template?
Yes. Loop through the rows in your worksheet and create a new mail item from the template for each recipient.
Does this work on Mac?
No. Outlook automation from Excel VBA is a Windows desktop feature; Mac Excel does not support the same object model.
Can I use a .msg file instead of .oft?
CreateItemFromTemplate expects an Outlook template (.oft). A saved .msg file is not the same format and may not open correctly with that method.
Why does Outlook ask for permission every time?
Outlook's security settings warn when a program tries to send email. You can allow it, or use .Display and send manually if your organisation restricts automation.
Can I add attachments in the loop?
Yes. Use .Attachments.Add with a full file path before sending, and check the file exists first.