R
Ridge Kennedy
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
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