ID: Q91077
The information in this article applies to:
Microsoft Word for Windows does not include an option to write the contents of your Autotext entries to a text file. This article contains two macros that you can use to export your Autotext entries to a text file named either GLOBAL.TXT (for global Autotext entries) or TEMPLATE.TXT (for template Autotext entries).
Note: To generate a printed list of your AutoText entries instead of a text file, choose Print from the File command, select AutoText Entries in the Print What box, and choose the OK button.
Note: Microsoft provides this macro code "as is" without warranty of any kind, either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.
Use the following macro to write the global AutoText entries (entries from NORMAL.DOT and any global templates) to a text file named GLOBAL.TXT, stored in the current directory:
Sub MAIN
Open "GLOBAL.TXT" For Output As #1
For count = 1 To CountAutoTextEntries()
a$ = AutoTextName$(count)
Print #1, "Autotext Name: ", a$
Print #1, GetAutoText$(a$)
Print #1, ""
Next count
Close #1
End Sub
Use the following macro to write the Autotext entries from the current template to a text file named TEMPLATE.TXT, stored in the current directory:
Sub MAIN
Open "TEMPLATE.TXT" For Output As #1
For count = 1 To CountAutoTextEntries(1)
a$ = AutoTextName$(count, 1)
Print #1, "Autotext Name: ", a$
Print #1, GetAutoText$(a$, 1)
Print #1, ""
Next count
Close #1
End Sub
The CountAutoTextEntries function determines the number of Autotext
entries for the specified context (global is the default context).
The AutoTextName$ function returns the Autotext name, which the
GetAutoText$ function uses to retrieve the contents of the Autotext
entry.
Use the following macro to insert all global AutoText entries into a new document window.
Sub MAIN
FileNewDefault
For count = 1 To CountAutoTextEntries()
a$ = AutoTextName$(count)
Bold 1 : Insert a$
InsertPara
Bold 0 : EditAutoText .Name = a$, .Insert
InsertPara : InsertPara
Next
End Sub
Kbcategory: kbusage kbmacro KBSubcategory: Additional query words: 6.0 export autotext winword
Version : 6.0
Platform : WINDOWS
Last Reviewed: July 30, 1997