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 / January 2008

Tip: Looking for answers? Try searching our database.

Autotext and Macro and Sharing

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mickey - 28 Jan 2008 13:48 GMT
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
 
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.