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 / June 2005

Tip: Looking for answers? Try searching our database.

Inserting Autotext

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
kas - 17 Jun 2005 23:41 GMT
What is the code to insert an autotext entry at the beginning of a document?

Any help would be greatly appreciated.
Jay Freedman - 18 Jun 2005 00:55 GMT
>What is the code to insert an autotext entry at the beginning of a document?
>
>Any help would be greatly appreciated.

Assuming that the autotext entry is stored in the Normal.dot template,
that its name is TheEntry, and that you want it formatted as it was
stored and not as plain text, you can do this:

  Dim MyRange As Range

  Set MyRange = ActiveDocument.Range
  MyRange.Collapse wdCollapseStart

  NormalTemplate.AutoTextEntries("TheEntry").Insert _
       Where:=MyRange, RichText:=True

A more complicated example is shown at
http://word.mvps.org/FAQs/MacrosVBA/NestedFieldsWithVBA.htm.

--
Regards,
Jay Freedman
Microsoft Word MVP         FAQ: http://word.mvps.org
 
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.