Results 1 to 6 of 6
  1. #1
    5 Star Lounger Lugh's Avatar
    Join Date
    Jun 2010
    Location
    Indy
    Posts
    620
    Thanks
    166
    Thanked 77 Times in 68 Posts

    Autotext in Word 2010 - extract/export contents

    I have a custom template set up in Word 2003, and brought successfully thru Word 2007 and now in Word 2010. Over the years it's accumulated a few hundred Autotext entries, which have always worked fine, no problems.

    I now need the contents of the individual Autotexts for entry into an Excel spreadsheet [Excel 2010] which I need to upload to an external company. The format etc of the spreadsheet in not changeable or negotiable, it feeds into auto-systems on their end.

    Is there some way to 'dump' the entire contents of the Autotext 'container' held in my template? Get them all in a text file would be fine--it would be great if they could also have their name adjacent to the text block, but I'll take anything which gets them out of the 'box' and into easily findable and editable 'open ground'.

    I'm trying to avoid a laborious one-by-one "Insert Autotext > Type name of Autotext above it > Repeat" a few hundred times.

  2. #2
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts
    If you create a new document based on your template, and then run the following code, it will insert into the document all of the autotexts contained in the template, preceded by the autotext name.
    Code:
    Sub InsertAllAutotexts()
       Dim ATE As AutoTextEntry
       For Each ATE In ActiveDocument.AttachedTemplate.AutoTextEntries
          Selection.TypeText ATE.Name & vbCrLf
          ATE.Insert Where:=Selection.Range, RichText:=True
          Selection.TypeParagraph
       Next 'ATE
    End Sub
    Gary

  3. The Following User Says Thank You to Gary Frieder For This Useful Post:

    Lugh (2012-01-19)

  4. #3
    5 Star Lounger Lugh's Avatar
    Join Date
    Jun 2010
    Location
    Indy
    Posts
    620
    Thanks
    166
    Thanked 77 Times in 68 Posts
    Gary, you are so right, thank you very much! You saved me a lot of time

  5. #4
    New Lounger
    Join Date
    Nov 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I am really interested in this!!
    I have over a thousand entries in Autotext from Word 2003 that I would dearly love to export to Excel without having to do it manually!
    How do I run the code mentioned in the previous message?
    Thanks
    Mal

  6. #5
    Silver Lounger Charles Kenyon's Avatar
    Join Date
    Jan 2001
    Location
    Sun Prairie, Wisconsin, Wisconsin, USA
    Posts
    2,049
    Thanks
    124
    Thanked 119 Times in 116 Posts
    Charles Kyle Kenyon
    Madison, Wisconsin

  7. #6
    New Lounger
    Join Date
    Nov 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks a mill Charles.

    I setup the Macro according to these instructions but I got the error "cant execute code in break mode"....any suggestions?
    I have clicked "enable all macros" and "Trust access to VBA.." in macro security
    Our Autotext is in the normal template of word 2010, which I brought across from Word 2003.

    Thanks
    Mal

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •