Microsoft KB Archive/86710

{|
 * width="100%"|

WD: WordBasic Macro to Generate Catalog of Clip-Art Pictures

 * }

Q86710

-

The information in this article applies to:


 * Microsoft Word for Windows, versions 2.0, 2.0a, 2.0a-CD, 2.0b, 2.0c, 6.0, 6.0a, 6.0c
 * Microsoft Word for Windows, versions 7.0, 7.0a
 * Microsoft Word for the Macintosh, versions 6.0, 6.0.1

-

SUMMARY
This article contains a macro that you can use in Microsoft Word to display or print a catalog of the graphic images in Word. This macro is helpful because there is no printed documentation showing the graphic images in Word.

These images are located in the CLIPART subdirectory. The macro below creates a document, inserts each graphic image in a table (three images per row), and lists the filename of each image. Note: There is a limit of 200 total images built into this macro.

MORE INFORMATION
  Sub MAIN ' Dimension an array to hold the filenames of the images. Dim f$(200) ' Insert a three column table to provide a columnar place to     ' display the images. TableInsertTable .NumColumns = &quot;3&quot; ' Loop through all the filenames that meet the specified ' image type using the Files$ function from WordBasic. i = 0 file$ = Files$(&quot;*.wmf&quot;) f$(i) = file$ While file$ <> &quot;&quot; file$ = Files$ i = i + 1 f$(i) = file$ Wend ' Now that the filenames are stored in an array, loop ' through the array and bring in the images. For j = 0 To i - 1 ' First insert the filename and a paragraph mark. Insert f$(j) InsertPara ' Now insert the picture and some paragraph marks. InsertPicture f$(j) CharLeft 1, 1 CharRight InsertPara InsertPara InsertPara ' Use the NextCell command to generate a new row in the table. NextCell Next j   End Sub NOTE: Word 6.x for the Macintosh users, replace the line:

  file$ = Files$(&quot;*.wmf&quot;) with:

  file$ = Files$(MacID(&quot;PICT&quot;))

Using This Macro
To use this macro, follow these steps:

 Make the directory that contains the images the current directory by choosing Open from the File menu and double-clicking the appropriate directory in the Directories box. Choose the Cancel button.  Change the line in the macro that reads      file$ = Files$(&quot;*.wmf&quot;) to reflect the appropriate extension of the pictures you want to view. For example, if you are generating a catalog of .BMP images that were created in Paintbrush, the line should read as follows:      file$ = Files$(&quot;*.bmp&quot;)  Create a new document and run the macro.

Additional query words: hard copy

Keywords : kbmacro wordnt winword ntword macword word6 winword2 word7 word95

Issue type : kbhowto

Technology :