How to Open Outlook Templates and Files using Toolbar Buttons

Last reviewed on October 29, 2014   —  48 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

About Diane Poremsky

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 Outlook forums by

48 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?

    1. Diane Poremsky

      Is the template link using the outlook:// protocol? See - you need to enable Outlook to use it.

  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?

    1. Diane Poremsky

      The outlook:// protocol? See Shortcuts and the Missing Outlook:// Protocol

  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.

    1. Diane Poremsky

      Did you try adding it to IE's trusted lists- either the trusted or local intranet zone?

  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!!

    1. Diane Poremsky

      Is macro security set to low? Once you are done testing, you can sign the macro and raise the security level if desired.

  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.



    1. Diane Poremsky

      Thanks for the update. I had no idea Xonbi would affect it - I'll keep that in mind when other users complain that macros don't 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

    1. Diane Poremsky

      You'd set the folder in this line:
      Set Items = Application.ActiveExplorer.CurrentFolder.Items

      assuming a subfolder of the default called shared
      Set Items = Session.GetDefaultFolder(olFolderContacts).Folders("Shared").Items

      See working vba non-default folders/ for more details

  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.

    1. Diane Poremsky

      Do you have macro security set to low? That is the most common reason for macros to stop working and you don't receive errors.

  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.

    1. Diane Poremsky

      Yep, that is one of my favorite ways to use and store templates - the nice part is, when you use an exchange mailbox, they are always available. Even with a pst file, they are always backed up. :)

  11. david hilton

    how do you do this for outlook 2013

    1. Diane Poremsky

      You need to use one of the macros and customize the toolbar - File, Options, Customize Ribbon. Select Macros from the dropdown and add the macro button to the ribbon.

  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

    1. Diane Poremsky

      Not a problem. I really should have a better video showing how to do it. See if this helps you see how to do it -

  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

    1. Diane Poremsky

      Which macro are you using? If the macro name line is like this: sub macroname (item as mailitem) the macro is called by other macros or is used in a run a script rule. It won't be in the list because you can't run it directly. If it's not that, post the macro here and i'll look at it.

  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

    1. Diane Poremsky

      Is macro security set to low? Check in File, Options, Trust Center, Macro Settings.

  15. david hilton

    I have it set at " Notifications for all macros"

    1. Diane Poremsky

      And no errors when you click the button? Does the macro work if you try to run it from the VB editor?

  16. Diane Poremsky

    I'm assuming you updated the path here - Set newItem = Application.CreateItemFromTemplate("c:\path\template.oft") - not doing so should trigger an error though.

  17. Daktus

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

  18. 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?

    1. Diane Poremsky

      That is how you are supposed to paste the code, but it should paste it on separate lines. With some other programs, I need to paste into Notepad then copy from notepad and paste in the app. That might work here. Sometimes if you double click on the code on these pages, it goes into a single line - if you copy it, it pastes as separate lines.

  19. 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!

    1. Diane Poremsky

      Which browser are you using? I'll try to repro the problem.

  20. Phil Reinemann

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

    1. Diane Poremsky

      Thanks I'll see if i can repro because it should copy the code correctly. :(

  21. 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.

    1. Diane Poremsky

      Use it as the reply template? Yes, you can do that. You need to put a little more code into it - the macros at are used for auto reply but kind of give you an idea of what you need to do for the body. You'd also need to work with the selection. Ah, what the heck :) I updated the page to include a macro that you run when needed.

  22. 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

  23. 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!!

  24. 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.

    1. Diane Poremsky

      Macros are hard to deploy as the user needs to 'touch' the vba editor to enable them. Sorry.

  25. Sam Stinger

    HI Diane,
    It works like charm. Thank you so much for sharing such a valuable piece of information. I would be grateful if there exits any way to integrate/package this code so that it can be executed on multiple machines rather going and touching the VBA editor on every workstation. Any help will mean a lot.


  26. Jack M. O

    Thanks for your thorough How to. It was very helpful to me in getting an older version custom appointment form into Office365. One final glitch is that my QAT button / macro code to open the published form doesn't inherit the active date chosen on the calendar so behaves differently than opening the form manually. Jack

  27. Jack M. O

    I took one more crack at it, and came up with this version that seems to work.

    Public Sub OpenPublishedForm()
    Dim Items As Outlook.Items
    Dim Item As Object
    WindRaised = Application.ActiveExplorer.CurrentFolder
    If WindRaised = "Calendar" Then
    StartDa = Application.ActiveExplorer.CurrentView.SelectedStartTime
    EndDa = Application.ActiveExplorer.CurrentView.SelectedEndTime
    Set Items = Application.ActiveExplorer.CurrentFolder.Items
    Set Item = Items.Add("ipm.Appointment.VacationEvent")
    Item.Start = StartDa
    Item.End = EndDa
    MsgBox ("This Action cannot be executed unless you are viewing your calendar")
    End If
    End Sub

Leave a Reply

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

This site uses XenWord.