When you want to open a template, you need to go through the Choose Form dialog, which is a few more steps than most users want to take. In older versions of Outlook you could create Hyperlink buttons but Outlook 2010 and newer doesn't support hyperlink buttons and tighter security in Outlook 2007 means you need to respond to a warning dialog before the template (or hyperlinked file) opens.
We have solutions for both problems: a macro for Outlook 2010 and newer (also works with Outlook 2007) and a registry key to disable the warning in Outlook 2007.
See Disable the Unsafe Hyperlink Warning when Opening Attachments for the instructions to disable the warning dialog and the Open or Save dialog. Use this registry value with Outlook 2010 if you add files to Outlook's Shortcut navigation pane.
Open templates using a toolbar button
To create a button on the toolbar that will open a template in Outlook 2010 and up, you need to use a macro as it does not support hyperlink buttons found in older versions of Outlook. Additionally, opening a template hyperlinked to a toolbar button in Outlook 2007 brings up a security dialog.

Note: if the template contains custom fields, the customizations will be disabled and the template will be blank. These templates need to be opened using the Choose Form dialog.
The solution
Create a macro that replicates opening a template from the Choose Form dialog using the Application.CreateItemFromTemplate method:
Sub MakeItem()
Set newItem = Application.CreateItemFromTemplate("c:\path\template.oft")
newItem.Display
Set newItem = Nothing
End Sub
Press Alt+F11 to open Outlook's VB Editor then copy and paste this macro into ThisOutlookSession. Add it to the ribbon or QAT. See How to use the VBA Editor for complete instructions to use the VB Editor. See Customize the QAT if you need help customizing the QAT.
If you want to use a macro to open different templates, assign the template path to a variable and pass the variable to the macro, like this:
Dim template As String Sub OpenTemplate1() template = "C:\Users\Diane\Templates\template1.oft" MakeItem End Sub Sub OpenTemplate2() template = "C:\Users\Diane\Templates\email.oft" MakeItem End Sub Private Sub MakeItem() Set newItem = Application.CreateItemFromTemplate(template) newItem.Display Set newItem = Nothing End Sub
Open a Template and Add an Attachment
If you want to add an attachment to the message at the same time you open the template, you'll use newItem.Attachments.Add "C:\myfile.doc". Add it to your code after the line that opens the template (DUH!) and before the message is displayed (newItem.Display).
The macro will look something like this:
Sub AddAttachment ()
Dim newItem as Outlook.MailItem
Set newItem = Application.CreateItem("C:\path\template.oft")
newItem.Attachments.Add "C:\myfile.doc"
newItem.Display
End Sub
Open a published form
If you want to open a published form, use this code to call the form. You need to be viewing the folder you want the item to be saved in.
Use GetDefaultFolder function to use the default folder for the custom form type. For example, change the Set items line to this the following to create an appointment or meeting in the Calendar folder from any other folder:
Set Items = Session.GetDefaultFolder(olFolderCalendar).Items
Public Sub OpenPublishedForm()
Dim Items As Outlook.Items
Dim Item As Object
Set Items = Application.ActiveExplorer.CurrentFolder.Items
Set Item = Items.Add("ipm.note.name")
Item.Display
End Sub
Add a button to the ribbon tutorial
This tutorial shows you how to add a button to one of Outlook 2013's ribbon tabs. Note: In Outlook 2010 you cannot add buttons to the ribbon but you can add buttons to the QAT. The method is the same, starting with File, Options, Quick Access Toolbar.
Create a Hyperlink button
This works in Outlook 2007 and older versions as well as all Office applications that have the Assign Hyperlink option on customized buttons. You can hyperlink to any file, although programs (*.exe) may be restricted for security reasons.

You can use any button in the Customize dialog (select a category on the left to see additional buttons). If you want to create a menu button, there is a blank one in the New Menu category.
- Right click on the toolbar area.
- Choose Customize
- From the Commands tab, drag a button (any button) to the Menu bar or a Toolbar
- Right click on the button to expand the customize menu
- Click Assign Hyperlink then Open and select the file you want to open.
Video Tutorial
In Outlook 2007's main interface and in Outlook 2003 and older, you'll add a button to the toolbar as shown in the following video.
Disable the hyperlink warning
When you open templates or files using a hyperlink button or from Outlook's Shortcut navigation pane, you'll receive an unsafe hyperlink warning. You can disable the warning by editing the registry.

You may also receive the file open or save dialog when using a hyperlink button or shortcut. To disable this dialog when the "Always ask" field is grayed out, run Outlook as administrator. The "always ask" checkbox should be clickable. If not, you'll need to edit the registry for each file type. See Disable "Always ask before opening" dialog for more information.

The solution
Add a registry value to disable the warning dialog.
Open the registry editor and browse to the following registry subkey for
Outlook 2016:
HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Common\Security
Outlook 2013:
HKEY_CURRENT_USER\Software\Microsoft\Office\15.0\Common\Security
Outlook 2010:
HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Common\Security
Outlook 2007:
HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Common\Security
Note: If the Security key does not exist in your registry, you'll need to create it too.
Right click on Security key and choose New, DWORD. Type (or paste)
DisableHyperlinkWarning as the Value name then double click on it. Enter 1 as the Value data to disable the warning. Delete the key or use a value of 0 to enable the warning.

Group policy keys for administrators
Administrators will add the DisableHyperlinkWarning DWORD to the Policy key instead:
Outlook 2016:
HKEY_CURRENT_USER\Software\Policies\Microsoft\Office\16.0\Common\Security
Outlook 2013:
HKEY_CURRENT_USER\Software\Policies\Microsoft\Office\15.0\Common\Security
Outlook 2010:
HKEY_CURRENT_USER\Software\Policies\Microsoft\Office\14.0\Common\Security
Outlook 2007:
HKEY_CURRENT_USER\Software\Policies\Microsoft\Office\12.0\Common\Security
Do It For Me
If you don't want to edit the registry yourself, you can download and run the following registry key for your version of Outlook.
Outlook 2016Outlook 2013Outlook 2010
Outlook 2007
More Information
To add a toolbar button to launch an Outlook form (OutlookCode.com)
Outlook 2010: Open custom form via your own ribbon (vboffice.net) VBA sample to open custom form
Opening a Saved Outlook Template (.oft file) in Office
2003 and 2007 Whitepaper by Helen Feddema
How to enable or to disable hyperlink warning messages in 2007 Office programs and in Office 2010 programs (MSKB)
How to disable hyperlink warning messages in Office 2003 (MSKB)
Leave a Reply
95 Comments on "How to Open Outlook Templates and Files using Toolbar Buttons"
Appled the Multiple Template VBA , only the first one opens the second one does not: Run time error 2147287038 (800300002) Cannot open file , the file is in the same folder as the first one. C:\Users\Username\AppData\Roaming\Microsoft\Templates\2nd.oft. ...help???
The template opens ok if you paste the path into the address bar of windows explorer? Try changing the filename to something with all lower case letters and see if it works. Also check the file permissions.
I was able to get the macro to work using multiple templates. Thanks a lot for that!
I was wondering if it would be possible to have the macro take whatever email address I have in my clipboard and paste it into the To: address when I click the Template button?
Thanks again!
Sure. See http://www.slipstick.com/developer/code-samples/paste-clipboard-contents-vba/ for an example. Add the 4 lines of code above the first screenshot to your macro (before the template loads) and add a reference to the forms library then add this after the template loads & before display -
newItem.to = strPaste
Tried something this, get no errors but the emails from clipboard aren't pasted into the To:
Dim template As String
Sub Followup()
Dim DataObj As MSForms.DataObject
Set DataObj = New MSForms.DataObject
DataObj.GetFromClipboard
strPaste = DataObj.GetText(1)
template = "C:\Templates\1.oft"
MakeItem
End Sub
Sub Retention()
Dim DataObj As MSForms.DataObject
Set DataObj = New MSForms.DataObject
DataObj.GetFromClipboard
strPaste = DataObj.GetText(1)
template = "C:\Templates\2.oft"
MakeItem
End Sub
Private Sub MakeItem()
Set newItem = Application.CreateItemFromTemplate(template)
newItem.To = strPaste
newItem.Display
Set newItem = Nothing
End Sub
Try adding Dim strPaste As String at the top, with the dim template line.
10X
Very Usefully
Hi, I'm trying to use the "Open a published form" code above to open a custom meeting invite form in Outlook 2013, but when I try to send the meeting I get this error:
"This meeting is not in the calendar folder for this account. responses will not be tallied."
The form works as expected when I use the "Choose form" dialogue, any ideas?
It's these lines - they tell outlook to use the current folder, not the default folder.
Set Items = Application.ActiveExplorer.CurrentFolder.Items
Set Item = Items.Add("ipm.note.name")
change the line that sets the folder to
Set Items = Session.GetDefaultFolder(olFolderCalendar).Items
I have some vba code to bring the Stationery Picker that I started since Outlook 97, I have modified it through several versions all the way up to 2010, however, now I am at 2013 and it stopped working, I get an Error 91: Object variable with block variable not set.
Specifically this piece of code is the culprit in 2013:
set objCB=Application.ActiveExplorer.Commandars.FindControl(, 5611)
This used to bring up the Stationery Picker menu.
Your help is greatly appreciated.
Outlook 2013 (and up) doesn't support command bar objects. Use the IRibbonExtensibility interface in an Outlook 2013 add-in instead of command bars. Yeah, i know, this probably won't help you because of how you were using it (plus I think it's a bit more complicated). More info: https://msdn.microsoft.com/en-us/library/office/ff868522.aspx
I'm using Outlook 2007 on Windows 7. I've read about the CommandBars IDs and I've searched all over the web, but can't find the ID for this window.
I've done that.
It occurs to me, can a macro initiate keystrokes in a dialog box? 4 down arrow keystrokes, followed by 3 tabs would do it.
okay, heard back from my developer friends and they said no, you can't bring up the form chooser using VBA. What version of Outlook do you use? You might be able to get it open using the commandbars ID, then could use sendkeys to select the templates from the dropdown, but that is really messy. There are some windows macro apps - like autoit that might be able to do it.
That would be Sendkeys and it would only work if we can open the dialog using VBA.