bottom
Great WordTips!
         
Your e-mail address is safe!
Close Note

Tips.Net > WordTips Home > Macros > WordBasic Examples > Printing Graphic Thumbnails with WordBasic

Printing Graphic Thumbnails with WordBasic

Summary: Got a folder full of photos, and you want to get a handle on what you've got? Use this handy WordBasic macro and you can get a grip on your graphics fast! (This tip works with Microsoft Word 6, and Word 95.)

If you work with graphics quite a bit, you are probably already familiar with the term "thumbnails." These are smaller versions of your graphics, printed on a single page, that allow you to get a "birds-eye view" of all your graphics. Many graphics programs and desktop publishing programs include a thumbnail feature that allows you to automatically print your overview. Unfortunately, Word does not include this feature--until now. The following macro, written in WordBasic, creates a set of thumbnail images from the contents of a single directory.

Sub MAIN
Directory$ = "d:\temp"
FType$ = "*.pcx"

ChDir Directory$
FileFind .SearchPath = Directory$, .Name = FType$
NumFound = CountFoundFiles() - 1
If NumFound >= 0 Then
   FileNewDefault
   TableInsertTable .ConvertFrom = "", \
      .NumColumns = "5", .NumRows = "1", \
      .InitialColWidth = "Auto", .Format = "0", \
      .Apply = "167"
   TableSelectTable
   TableRowHeight .RulerStyle = "0", \
      .LineSpacingRule = 0, .LineSpacing = "", \
      .LeftIndent = "0" + Chr$(34), .Alignment = 1, \
      .AllowRowSplit = 0
   StartOfLine
   ColCount = 1
   For J = 0 To NumFound
      FName$ = FoundFileName$(J + 1)
      InsertPicture .Name = FName$, .LinkToFile = "0"
      CenterPara
      InsertPara
      FormatFont .Points = "10", .Underline = 0, \
         .Color = 0, .Strikethrough = 0, \
         .Superscript = 0, .Subscript = 0, .Hidden = 0, \
         .SmallCaps = 0, .AllCaps = 0, .Spacing = "0 pt", \
         .Position = "0 pt", .Kerning = 0, \
         .KerningMin = "", .Tab = "0", .Font = "Arial", \
         .Bold = 1, .Italic = 0, .Outline = 0, .Shadow = 0
      Insert Mid$(FName$, Len(Directory$) + 2)
      CharRight 1
      ColCount = ColCount + 1
      If ColCount = 6 Then
         If J <> NumFound Then
            TableInsertRow .NumRows = ""
            EndOfLine
            CharRight 1
            TableInsertRow .NumRows = ""
            StartOfLine
            ColCount = 1
         End If
      End If
   Next
End If
End Sub

In this macro, all you need to do is change the line specifying Directory$ to reflect the directory in which your graphics are stored. You can also change the graphic file specification by changing the assignment of FType$ (currently it is set to return all PCX files in the directory). When you run this macro, a new document is created and the macro starts building a table with five columns and however many rows are necessary to print your graphics. The macro will print about 40 or 48 thumbnails on a piece of paper, depending on the settings you use in your default template.

Tip #115 applies to Microsoft Word versions: 6 | 95


Take Control! Master the real power behind Word! Successfully master the secrets of powerful formatting and create documents that stand out from the rest. Best of all, you can create documents that are easy to maintain and quick to change.
 
Check out Word 2007 Styles and Templates today!

Helpful Links

Ask a Word Question
Make a Comment

Tips.Net Home
Tips.Net Store

WordTips FAQ
WordTips Premium

Learn Access Now

Beauty Tips
Bugs and Pests Tips
Car Tips
Cleaning Tips
College Tips
Cooking Tips
Excel2007 Tips
ExcelTips
Family Tips
Gardening Tips
Health Tips
Home Tips
Money Tips
Organizing Tips
Pet Tips
Word2007 Tips
WordTips

Advertise on the
WordTips Site

 

Great Info!

Get tips like this every week in WordTips, a free productivity newsletter. Enter your e-mail address and click "Subscribe."
     
(Your e-mail address will never be shared with anyone, ever.)