Dear All,

I have a sub that works. It looks to the normal.dot. to Find an autotext
entry. I'd like to be able to tell it to look for a specific template
elsewhere -- not necessarily one of the default template directories. A
pointer in the direction of how to declare a different template as a
variable would be appreciated. And, does the templated have to be "open" to
be able to access an autotext entry??

Code for macro follows.

Thnaks

Ridge (in New Joisey)

Public Sub DocNameAndPath()
' a macro to use the standard Word autotext entry
' "Filename and Path" stored in the normal template
' to add the filename and path to the end of a document

Dim myRange As Range
Dim oDoc As Object
Set oDoc = ActiveDocument
Set myRange = oDoc.Range
myRange.Collapse (wdCollapseEnd)
myRange.InsertAfter (vbCrLf)
myRange.Font.Name = "arial"
myRange.Font.Size = 8
myRange.Font.Italic = False
myRange.Font.Bold = False
myRange.Paragraphs.Alignment = (wdAlignParagraphLeft)

NormalTemplate.AutoTextEntries("Filename and Path").Insert
Where:=myRange, RichText:=True
Set myRange = oDoc.Range
myRange.Collapse (wdCollapseStart)
myRange.Select

End Sub

Re: Identify a Different Template for AutoText Entry by Oliver

Oliver
Mon Mar 06 14:16:06 CST 2006

> I have a sub that works. It looks to the normal.dot. to Find an autotext
> entry. I'd like to be able to tell it to look for a specific template
> elsewhere -- not necessarily one of the default template directories. A
> pointer in the direction of how to declare a different template as a
> variable would be appreciated. And, does the templated have to be "open"
> to be able to access an autotext entry??

You could loop through the Templates collection and see if the Autotext
exists in it.

Alternatively, you can just do a type the text of the bookmark in, and the
do InsertAutoText.

Yes, it does need to be open.

Oliver Townshend



Re: Identify a Different Template for AutoText Entry by Charles

Charles
Mon Mar 06 19:25:43 CST 2006

It doesn't need to be open, it does need to be loaded. You load a template
and make its AutoText available to all document by putting it in the Word
Startup folder. This makes it an Add-In, and it will show up in the
templates collection. See http://addbalance.com/word/movetotemplate.htm for
step-by-step instructions on moving / sharing / copying / backing-up
customizations including AutoText, AutoCorrect, keyboard assignments,
toolbars, macros, etc.
--

Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide

See also the MVP FAQ: http://word.mvps.org/FAQs/ which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.

"Ridge Kennedy" <rkennedy@njscpa.org> wrote in message
news:ecg7xEVQGHA.6008@TK2MSFTNGP10.phx.gbl...
> Dear All,
>
> I have a sub that works. It looks to the normal.dot. to Find an autotext
> entry. I'd like to be able to tell it to look for a specific template
> elsewhere -- not necessarily one of the default template directories. A
> pointer in the direction of how to declare a different template as a
> variable would be appreciated. And, does the templated have to be "open"
> to be able to access an autotext entry??
>
> Code for macro follows.
>
> Thnaks
>
> Ridge (in New Joisey)
>
> Public Sub DocNameAndPath()
> ' a macro to use the standard Word autotext entry
> ' "Filename and Path" stored in the normal template
> ' to add the filename and path to the end of a document
>
> Dim myRange As Range
> Dim oDoc As Object
> Set oDoc = ActiveDocument
> Set myRange = oDoc.Range
> myRange.Collapse (wdCollapseEnd)
> myRange.InsertAfter (vbCrLf)
> myRange.Font.Name = "arial"
> myRange.Font.Size = 8
> myRange.Font.Italic = False
> myRange.Font.Bold = False
> myRange.Paragraphs.Alignment = (wdAlignParagraphLeft)
>
> NormalTemplate.AutoTextEntries("Filename and Path").Insert
> Where:=myRange, RichText:=True
> Set myRange = oDoc.Range
> myRange.Collapse (wdCollapseStart)
> myRange.Select
>
> End Sub
>



Re: Identify a Different Template for AutoText Entry by Ridge

Ridge
Wed Mar 08 14:59:24 CST 2006

Thank you, Oliver and Charles. R.