Re: When opening Word, how can template also opens the Apply Style by Jonathan
Jonathan
Sun Feb 18 05:37:10 CST 2007
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
"Tranquilo" <Tranquilo@discussions.microsoft.com> wrote in message
news:DCF4E9D4-84CB-4F85-8469-85D50340BE12@microsoft.com...
> 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
>
>
>
> "Renee [MSFT]" wrote:
>
>> 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.
>> --
>> -----------------------------------------
>> This posting is provided "as is" with no warranties, and confers no
>> rights.
>>