When opening Word, how can template also opens the Apply Styles

T

Tranquilo

This is for Word 2007.
I have a custom template and want the Apply Styles window to open when
launching Word - can this be done through any settings in Word or is this
something that can be done progmatically?
Noted that if I attempt to record a macro where I click on Apply Styles (I
have it in my Quick Access toolbar), the action is not recorded.
 
R

Renee [MSFT]

Create a macro stored in your template and name it "AutoNew". Inside, put
the code to open the Apply Styles pane. e.g.

Sub AutoNew()
Application.TaskPanes(wdTaskPaneApplyStyles).Visible = True
End Sub

Save your template. Now if this is not your Normal template, but you want
to be able to double-click your Word icon and have it create the doc based on
your template and not Normal, create a new shortcut and use the /z switch to
specify your template name.
e.g. your Target would look something like
"C:\Program Files\Microsoft Office\Office12\WINWORD.EXE"
/zC:\Users\<yourusername>\AppData\Roaming\Microsoft\Templates\mypersonaltemplate.dotm

Make sure to use the actual path to your template after /z -- my path is on
Vista and the default template path is different on WinXP.
 
T

Tranquilo

Have to admit that I am having some fun with this, perhaps too much.
I changed the Macro so that was only:

Sub AutoNew()
Application.TaskPanes(wdTaskPaneApplyStyles).Visible = True
End Sub

The Macro runs in the template I have (my normal for Office 2007 in Vista)
but only if I open the Dev Tab then select the macro and run it - I was not
able to get the Apply Style window to open when opening Word

Looked around and found the following in another thread: "Can't Get Macro
That Works in Document To Work in Template in Word Programming " from
5/13/2005, the author of the post -Jezebel - which is not Office 2007, but
following the code, I was able to get the Document Map to open on opening
Word my template. Did not want the Doc Map, so I changed it to the Apply
Styles - still not working on opening Word.

The code I found was:

Sub Document_Open()
ActiveDocument.ActiveWindow.DocumentMap = True
ActiveDocument.ActiveWindow.DocumentMapPercentWidth = 20
With ActiveWindow
..View.ShowHeading 2
..DocumentMap = True
End With
End Sub


What makes it worse - my normal.dotx and normal.dotm both have the Doc Map
come up on this Vista machine, even through I have deleted both and copied
clean copies to this machine - also have cleared all macros on the template
by going into Developer (tab), opened Macros and deleted everythign under All
Active templates and Macros in the Macros in: drop down.

So..

How do I really clear the Document Map from Document_Open() and how do I get
the Apply Styles in my normal template? ANd should I be dinking that much
with the Normal?

Thanks
 
J

Jonathan West

Change the macro name from AutoNew to AutoExec

AutoNew runs whenever you create a new document. AutoExec runs whenever you
first load the template containing the macro (in the case of normal.dot,
this means when Word starts)

--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
 

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