Microsoft KB Archive/221958

= WD97: Sample Visual Basic Macro to Type All AutoText Entries =

Article ID: 221958

Article Last Modified on 8/14/2007

-

APPLIES TO


 * Microsoft Word 97 Standard Edition

-



This article was previously published under Q221958





SUMMARY
The following macro inserts all of the AutoText entries in your Normal.dot (global template) file into a new document. The new document includes the name of each AutoText entry in bold letters, followed by the actual AutoText entry.

NOTE: You can quickly print a list of all AutoText entries without using this macro example. To do this, follow these steps:
 * 1) On the File menu, click Print.
 * 2) In the Print dialog box, change the Print what box to AutoText entries.
 * 3) Click OK.



MORE INFORMATION
Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers 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 requirements.

For more information about how to use the sample code in this article, click the article number below to view the article in the Microsoft Knowledge Base:

173707 OFF97: How to Run Sample Code from Knowledge Base Articles

Sub InsertAllAutoText

Dim Entry As AutoTextEntry

Documents.Add

For Each Entry In NormalTemplate.AutoTextEntries

' Turn bold formatting on and insert the AutoText name Selection.Font.Bold = True Selection.TypeText Text:=Entry.Name

' Turn bold formatting off and insert AutoText entry Selection.Font.Bold = False Selection.TypeParagraph Entry.Insert Where:=Selection.Range, RichText:=True Selection.Range.Select Selection.TypeParagraph

' Insert a blank line between entries Selection.TypeParagraph Next

End Sub

Additional query words: entries vba vb

Keywords: kbautotext kbdtacode kbhowto kbmacroexample kbprogramming KB221958

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.