WD: Sample Visual Basic Macro to Type All AutoText Entries

ID: Q221958


The information in this article applies to:


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/refguide/


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: entries vba vb


Keywords          : kbdta 
Version           : WINDOWS:97
Platform          : WINDOWS 
Issue type        : kbhowto 

Last Reviewed: March 17, 1999