WD: Macros to Generate List of Available Fonts In WordLast reviewed: February 2, 1998Article ID: Q92927 |
The information in this article applies to:
SUMMARYThe following WordBasic macros generate a list of the fonts recognized by Microsoft Word and display a sample of each font. The font list generated by this macro depends on the printer you select in the Printer dialog box.
MORE INFORMATION
Word 2.x, 6.x, 7.xWARNING: ANY USE BY YOU OF THE CODE PROVIDED IN THIS ARTICLE IS AT YOUR OWN RISK. Microsoft provides this macro code "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose. Word 7.0 includes a FontSampleGenerator macro with Macros7.dot. Word 6.0 includes a FontSampleGenerator macro with Macros60.dot. The macro described below will also work with Word 6.0 and 7.0.
Sub MAIN 'speeds macro processing and suppresses display ScreenUpdating 0 FileNew For count = 1 To CountFonts() FontName$ = Font$(count) Font "Times New Roman", 12 Insert FontName$ + Chr$(11) Font FontName$, 12 Insert Chr$(9) + "abcdefghijklmnopqrstuvwxyz" + Chr$(11) Insert Chr$(9) + "0123456789?$%&()[]*_-=+/<>'" + Chr$(11) + \ Chr$(11) Next count End SubNOTE: ScreenUpdating is for use with Word version 6.x and 7.x only. If you are using this macro with an earlier version of Word, eliminate the ScreenUpdating line. CountFonts() returns the total number of fonts available to the selected printer. The For loop used above with CountFonts() sets up a loop that inserts the font names (FontName$) and the sample text. For a macro to use with Microsoft Word 97 please see the following article in the Microsoft Knowledge Base:
ARTICLE ID: Q170970 TITLE : WD97: Macro to Generate List of Available Fonts in Word REFERENCE"Using WordBasic," by WexTech Systems and Microsoft, pages 168 and 210
|
Additional query words: Font FontName$ sample
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |