WD2000: Sample Visual Basic Macro to Type All AutoText Entries

ID: Q221957


The information in this article applies to:
  • Microsoft Word 2000


SUMMARY

The following macro inserts all the AutoText entries in Normal.dot into a new document. The new document includes the name of each entry and separates the entries with horizontal lines. Note that you can quickly print a list of all AutoText entries by clicking Print on the File menu and selecting AutoText entries in the Print What box. It is not necessary to use a macro for this method.


MORE INFORMATION

Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft Support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact the Microsoft fee-based consulting line at (800) 936-5200. For more information about the support options available from Microsoft, please see the following page on the World Wide Web:

http://www.microsoft.com/support/supportnet/overview/overview.asp


Sub InsertAllAutoText()
Dim Entry As AutoTextEntry

Documents.Add

For Each Entry In NormalTemplate.AutoTextEntries
    Selection.Font.Bold = True
    Selection.TypeText Text:=Entry.Name
    Selection.Font.Bold = False
    Selection.TypeParagraph
    Selection.TypeText Text:=Entry.Value
    Selection.TypeParagraph
    Selection.TypeParagraph
Next
End Sub 

Additional query words: entreis vba vb

Keywords : kbdta wd2000
Version : WINDOWS:2000
Platform : WINDOWS
Issue type : kbhowto


Last Reviewed: November 13, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.