WD: WordBasic Macro to Generate Catalog of Clip-Art Pictures
ID: 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 95, 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 = "3"
' Loop through all the filenames that meet the specified
' image type using the Files$() function from WordBasic.
i = 0
file$ = Files$("*.wmf")
f$(i) = file$
While file$ <> ""
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$("*.wmf")
with:
file$ = Files$(MacID("PICT"))
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$("*.wmf")
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$("*.bmp")
- Create a new document and run the macro.
Additional query words:
hard copy
Keywords : kbmacro wordnt winword ntword macword word6 winword2 word7 word95
Version : MACINTOSH:6.0,6.0.1; WINDOWS:2.0,2.0a,2.0a-CD,2.0b,2.0c,6.0,6.0a,6.0c,7.0,7.0a
Platform : MACINTOSH WINDOWS
Issue type : kbhowto
|