Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / February 2007

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Tranquilo - 13 Feb 2007 19:07 GMT
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.
Renee [MSFT] - 14 Feb 2007 00:16 GMT
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.
Signature

-----------------------------------------
This posting is provided "as is" with no warranties, and confers no rights.

Tranquilo - 14 Feb 2007 21:37 GMT
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

> Create a macro stored in  your template and name it "AutoNew".  Inside, put
> the code to open the Apply Styles pane. e.g.
[quoted text clipped - 13 lines]
> 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.
Jonathan West - 18 Feb 2007 11:37 GMT
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)

Signature

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

> Have to admit that I am having some fun with this, perhaps too much.
> I changed the Macro so that was only:
[quoted text clipped - 66 lines]
>> on
>> Vista and the default template path is different on WinXP.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.