How to Open Outlook Templates and Files using Toolbar Buttons

Last reviewed on October 29, 2014   —  42 comments

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 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 (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, 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.

Template warning

Additionally, 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")
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"
End Sub

Sub OpenTemplate2()
template = "C:\Users\Diane\Templates\email.oft"
End Sub

Sub MakeItem()
Set newItem = Application.CreateItemFromTemplate(template)
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"
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.

Public Sub OpenPublishedForm()
   Dim Items As Outlook.Items
   Dim Item As Object
   Set Items = Application.ActiveExplorer.CurrentFolder.Items
   Set Item = Items.Add("")
 End Sub

Create a Hyperlink button

Assign a hyperlink to a buttonThis 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.

  1. Right click on the toolbar area.
  2. Choose Customize
  3. From the Commands tab, drag a button (any button) to the Menu bar or a Toolbar
  4. Right click on the button to expand the customize menu

Add a button to the ribbon or toolbar tutorials

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.

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.

Unsafe hyperlink warning

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.

Open or Save dialog

The solution

Add a registry value to disable the warning dialog.

Open the registry editor and browse to the following registry subkey for

Outlook 2013:

Outlook 2010:

Outlook 2007:

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.

Change the registry value

Group policy keys for administrators

Administrators will add the DisableHyperlinkWarning DWORD to the Policy key instead:

Outlook 2013:

Outlook 2010:

Outlook 2007:

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 2013Outlook 2010Outlook 2007

Written by

Diane Poremsky
A Microsoft Outlook Most Valuable Professional (MVP) since 1999, Diane is the author of several books, including Outlook 2013 Absolute Beginners Book. She also created video training CDs and online training classes for Microsoft Outlook. You can find her helping people online in Outlook Forums as well as in the Microsoft Answers and TechNet forums.

Please post long or more complicated questions at Outlookforums.

42 responses to “How to Open Outlook Templates and Files using Toolbar Buttons”

  1. Joel Chertock

    Hello, I'm adding a button in OL 2010 that I had working in OL2007 that opened a template file from a hyperlinked web page. OL2007 I could use a custom command that opened a hyperlink. OL2010, How do I do this? I can use a macro to link to a local file but how do I link to a file on a web page? The method above to createitemfromtemplate works only with local files. how can I get it to open files linked via a hyperlink?

  2. Joel Chertock

    Diane, thank you. The template link is not using the Outlook protocol you mention. That's a new one for me. Where can I find more on how to use this protocol to open a template file from a web link?

  3. doug

    yea.. 5 hours of googling this subject is unfruitful.. how do you tell outlook to TRUST the url location...."to protect your computer, licck only those hyperlinks fronm trusted soruces".
    Trust center (office word) can't handle an mms// location.

  4. Andy

    Hello Diane! I'm brand-spankin'-new to VBA and feel like I've jumped into the deep end of the pool (although I suspect I’m just splashing around in the kiddie pool still). I'm very excited to have found your site!

    I'm having difficulty with the macro to open a published form: (a) created a custom contact form to use with a specific set of contacts for a periodic mail merge; (b) published it to the "Personal Forms Library" and its message class is IPM.Contact.PIPECOI (it's named "PIPECOI"); (c) created a macro in "ThisOutlookSession" with the following:

    Public Sub OpenPublishedForm()
    Dim Items As Outlook.Items
    Dim Item As Object
    Set Items = Application.ActiveExplorer.CurrentFolder.Items
    Set Item = Items.Add("ipm.Contact.PIPECOI")
    End Sub

    When I run the macro nothing happens. I also created a button on the ribbon for the macro, which doesn't work either. I’ve tried running the macro when in a variety of folders but get the same result. Because I’m so very new to this, I don’t know if I’ve missed something obvious or if there is another issue I need to run-down. I’ll be grateful for any ideas or suggestions - thanks very much!!

  5. Andy

    Thank you - I set Macro Settings to "Enable all macros..." Still didn't work.

    On a whim I just looked at my COM Add-Ins wondering if any of them might be interfering. When I disabled Xobni, the macros worked.

    Now I have a different issue (macros versus Xobni) but at least I know that macros work.



  6. Andy

    Another question: is it possible to have this work in a way such that the custom contact form record will always save to the contacts folder regardless of the folder from which I execute the macro? Thanks again, Andy

  7. Andy

    To update re: Xobni - after disabling, running macro, relaunching Outlook and reenabling Xobni, the macro works fine.

  8. Andy

    Thanks very much! That worked perfectly.

  9. سام (@SamInMpls)

    This was working perfectly until I upgraded to Outlook 2013. Now the buttons do nothing.

  10. Keith Larsen

    Once a template is created and saved a file, use Windows Explorer to go to the tempalte folder. Select the template file(s) and drag and drop or copy them into any folder in Outlook. We create a folder called "-Forms" so it floats to the top where the template files are all quite easy to find and launch.

  11. david hilton

    how do you do this for outlook 2013

  12. david hilton

    Sorry to be obtuse but I am a newbie, I ran the macro and it said it worked but when I go to select macros the choice is their but their is nothing below it to click on it to move it from the left panel to the right panel, could you please walk me thru it with a little more detail, I am sure I am missing something

  13. david hilton

    Hi, when I click on the word macro unlike your video no choices appear in the left pane macro box for me to click onto to move to the right pane

  14. david hilton

    I have gone back thru you how to and followed all the steps, amazing what happens when one does that. The button is now on the ribbon but when I press it nothing happens. What do I do know?
    The macro I copied from your site follows:
    Sub MakeItem()
    Set newItem = Application.CreateItemFromTemplate("c:\path\template.oft")
    Set newItem = Nothing
    End Sub

  15. david hilton

    I have it set at " Notifications for all macros"

  16. Daktus

    just use free software called "fingertips" for this and other links

  17. Phil Reinemann

    Works great. I have three forms I commonly use and I was going to ask before reading this how to make Choose Form go straight to User Templates in File System but this exceeds that need (at the cost of Outlook real estate). I can live with the space-loss (until I need many more buttons).

    I copied Diane's code and pasted into VBA, but it put it all three macros on one line. Is there a better way to paste the code?

  18. Phil Reinemann

    I think it has something to do with the html code on this web page such that when copied the newlines or carriage returns or both aren't seen by the clipboard such that when pasted they append each line to the previous line.

    I've seen this on other code pages where to copy the code they provide a special "copy" button which takes the basic code, maybe minus formatting, and puts it in the clipboard.

    I tried copying the template1, template2 and MakeItem code into Notepad and they pasted as one long line, same as in the VB editor window. It's not a lot of code so I just put in the newlines where appropriate. (Except for one which I missed, so I got errors about object does not support this method for "newItem.DisplaySet" and even here, it didn't put in the newline between Display and Set.

    In any case when I fixed it all, the code works great. Again, thanks!

  19. Phil Reinemann

    The W7 clipboard viewer (I have Excel open) shows the copied text without newlines too.

  20. Giulio B.

    Thank you very much for the very clear instructions.

    Is it possible to run the macro to apply the template to an answered message and not to a new message?

    Thank you again.

  21. erikofmke

    Very Nice. I've never done this before, so I was playing around and guessing on how to add another template. I had 2, so I figure out that I could clone the macro, change the MakeItem to 1 and 2 (or more) and that create separated Objects in the macro list.

    I used:

    Sub MakeItem1()
    Set newItem = Application.CreateItemFromTemplate("C:\Users\ErikC\AppData\Roaming\Microsoft\Templates\IT Dept.oft")
    Set newItem = Nothing

    End Sub

    Sub MakeItem2()
    Set newItem = Application.CreateItemFromTemplate("C:\Users\ErikC\AppData\Roaming\Microsoft\Templates\ITtoUS.oft")
    Set newItem = Nothing
    End Sub

    It worked awesome

  22. Jason

    Thank you, thank you, thank you, thank you! I have dreaded the slow process of creating a new email from a template for so long, but today, thanks to you, I can now create new emails from specific templates with a single click!!

  23. Antoni

    Thank you,
    Workes great.
    I'm looking for a way to integrate this into every user account in our organization.
    Can this be done using GPO or Citrix roaming profile?
    Thanks on advance.

Leave a Reply

If the Post Coment button disappears, press your Tab key.