Wednesday, September 14, 2011

How-To: Create a Shortcut for Outlook 2007 Templates

Background/Purpose:  Outlook 2007 does not handle opening form templates the same way that its predecessors did.  You can no longer just double-click on an *.oft file and have it open on your desktop.  You must enter a series of button clicks/commands in Outlook to get it to open.  This procedure will show how to automate the process to make it easier on users.
This procedure uses a simple example and assumes you are using a home drive mapped to h:\ for end users. 
Here is the message a user would get if they try to double-click an *.oft file on a machine running Outlook 2007:

1 - Open OL2007 and click the Tools menu, then click Trust Center…

2 – Click on the Macro Security item and then choose either “Warnings for all macros” or “No security check for macros”.  Click OK.

Note:  “Warnings for all macros” is more convenient.  “No security check for macros” is more secure.
If you choose “Warnings for all macros”, then you will have to click through this warning when you run the macro:

3 –Click on the Tools menu and then click on Macro, Macros…

4 – In the Macros box that comes up, type the name of your macro (no spaces) and then click Create.


5 – In the VB editor that comes up, enter the following code making sure the path is correct for where the template form resides (*.oft file).


Click File, Save VbaProject.OTM

Close the VB editor.

6 – Click on Tools, Macro, Macros… and your new macro should be displayed in the box.  Select it and click the Run button to verify its operation.  Close the template that came up.

7 – Click on Tools, Customize…


8 – Click on the Commands tab and click on Macros under categories.  Your new macro should be displayed under Commands.

Click on the listed macro and drag it out to the menu location you want it in.  Give it a Friendly name.

Click Close.
Now you have shortcut that will open the form automatically instead of taking you through the steps listed here:
File > New > Choose Form > Look In: User Templates In File System > Your File.oft
The code should appear like this in the project:
---------------------------------------------------
Set newItem = Application.CreateItemFromTemplate("h:\your path\your form.oft")
newItem.Display
Set newItem = Nothing
---------------------------------------------------


6 comments:

  1. Can you tell me how to delete or edit items after I put them on the menu?

    ReplyDelete
  2. Thanks - The only stumbling block was the "ROC" string you had in front of the NRPA. I had to remove it for Outlook to find the macro

    ReplyDelete
  3. Helpful, well written, thanks!

    ReplyDelete