Hi,
I have a template that I would like to share. When I originally wrote it
(thanks to everyone for the help provided) I wrote a macro that called for an
autotext. At the time the autotext was stored in Normal.dot. I created a
new template with the macros and calls out the autotexts. I put the
autotexts in the new template also. I tried to share it but it looks for the
autotext to be in the Normal.dot template and not the new template. The
following is the macro. The new template I created is named "QPACE". I
thought I could change "NormalTemplate.AutoTextEntries("SOP")." to
"QPACETemplate".AutoTextEntries("SOP") and it would work, but it doesn't.
Any suggestions. As always thanks so much for any help provided.
Mickey
Sub AddHeaderSOP()
Dim r As Range
Dim s As Section
For Each s In ActiveDocument.Sections
Set r = s.Headers(wdHeaderFooterPrimary) _
.Range.Paragraphs(1).Range
With r
.ParagraphFormat.TabStops.ClearAll
.ParagraphFormat.TabStops(InchesToPoints(1.25)) _
.Alignment = wdAlignTabLeft
.ParagraphFormat.TabStops(InchesToPoints(6.5)) _
.Alignment = wdAlignTabRight
.Collapse wdCollapseStart
.Collapse wdCollapseEnd
If s.Index = 1 Then
NormalTemplate.AutoTextEntries("SOP").Insert _
Where:=r, RichText:=True
Else
NormalTemplate.AutoTextEntries("SOP2").Insert _
Where:=r, RichText:=True
End If
End With
Next s
End Sub
David Sisson - 28 Jan 2008 14:24 GMT
Change NormalTemplate.AutoTextEntries... to
ActiveDocument.AttachedTemplate.AutoTextEntries...
or better yet define as a object
Dim MyTemplate As Template
Set MyTemplate = ActiveDocument.AttachedTemplate
MyTemplate.AutoTextEntries...
Mickey - 28 Jan 2008 18:21 GMT
Thanks David. I tried it both ways and neither worked. Any other suggestions.
Thanks
> Change NormalTemplate.AutoTextEntries... to
> ActiveDocument.AttachedTemplate.AutoTextEntries...
[quoted text clipped - 6 lines]
>
> MyTemplate.AutoTextEntries...
Shauna Kelly - 28 Jan 2008 21:33 GMT
Hi Mickey
If the AutoTexts are in the same file as the file that contains the
code, then change
NormalTemplate.AutoTextEntries("SOP").Insert
to
ThisDocument.AutoTextEntries("SOP").Insert
"ThisDocument" refers to the file that contains the code.
Hope this helps.
Shauna Kelly. Microsoft MVP.
http://www.shaunakelly.com/word
> Hi,
> I have a template that I would like to share. When I originally wrote
[quoted text clipped - 48 lines]
>
> End Sub