Word 2007 Macro & quick access toolbar

J

Jeff Lowenstein

I would like to create a button on the quick access toolbar that creates a
new document based on a particular template. How do I do this? Please
explain in detail.
 
J

Jay Freedman

Jeff said:
I would like to create a button on the quick access toolbar that
creates a new document based on a particular template. How do I do
this? Please explain in detail.

Install this macro in your Normal.dotm template (see
http://www.gmayor.com/installing_macro.htm if needed):

Sub MakeMyDoc()
Const MyTemplate = "MyTemplate.dotx"
On Error GoTo ErrHdl

Documents.Add Template:=MyTemplate
Exit Sub

ErrHdl:
If Err.Number = 5151 Then
MsgBox "Could not find " & MyTemplate
Else
MsgBox Err.Number & vbCr & Err.Description
End If
End Sub

Change the filename in quotes from "MyTemplate.dotx" to the actual name of
the template you want the button to use.

Then right-click the Quick Access Toolbar and choose Customize. In the
category dropdown, choose Macros. Select the MakeMyDoc macro and click the
Add button. If you want, you can select the macro name on the right-hand
list and click the Modify button, from which you can change the icon and the
mouseover text for the button.

A small complication: the macro assumes that the template exists in the
folder named as the User Templates folder in the File Locations option
dialog. If you store the template anywhere else, you'll need to include the
full path in the MyTemplate constant, such as

Const MyTemplate = "D:\Extra Templates\MyTemplate.dotx"

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top