Please Note: This article is written for users of the following Microsoft Word versions: 97, 2000, 2002, and 2003. If you are using a later version (Word 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Word, click here: Inserting Multiple Graphics in a Document.

Inserting Multiple Graphics in a Document

Written by Allen Wyatt (last updated January 29, 2022)
This tip applies to Word 97, 2000, 2002, and 2003


1

Every week John needs to create an invoice and insert several scanned images into a Word document. He wonders if there is a way to put all of the JPG images from a particular folder into the current Word document.

There are a couple of ways you can do this. One way is to simply select all the graphics and insert them in one step:

  1. Place the insertion point at the place in the document where you want the graphics inserted.
  2. Choose Insert | Picture | From File. Word displays the Insert Picture dialog box.
  3. Use the Look In control to locate the folder that contains the images.
  4. Press Ctrl+A. Word selects all the files in the folder.
  5. Click OK or Insert, depending on your version of Word.

That's it; Word inserts all the graphics in the document. You'll want to be careful doing this, because if there are a lot (more than, say, 100) graphics in the folder or if the graphic files are quite large, you can slow Word to a crawl or hang it completely. If the folder contains more than just graphics or you want only some of the graphic files, you can hold down the Ctrl key as you use the mouse to select graphics in step 4. The point is that whatever files you have selected in step 4, those are the files that Word inserts in your document.

A variation on this approach involves the use of Windows. Follow these general steps:

  1. Place the insertion point at the place in the document where you want the graphics inserted.
  2. Minimize the Word document.
  3. In Windows, display the folder where the images are located.
  4. Build a selection set of the images you want inserted in the document.
  5. Click on any single image in the selection set and hold down the mouse button.
  6. Drag the selection set over the top of the document as it appears in the Taskbar. (Don't release the mouse button quite yet.)
  7. Once Windows displays the Word document (which it does after a few seconds), release the mouse button.

At this point, all the images you selected in step 4 are inserted in the Word document, the same as in the earlier method.

If you use either of the foregoing methods, you'll need to resize images and move them around, as necessary, so your document appears the way you desire.

Of course, if you need to insert whole groups of images on a routine basis, then going through these steps can become tiresome after a while. Tedium is often relieved through the use of a macro, and this case is no exception. The following macro can be used to display a dialog box (similar to those used in the earlier methods) where you can select the files you want. When you close the dialog box, any images you selected within the dialog box are inserted in your document, each in its own paragraph.

Sub InsertImages()
    Dim doc As Word.Document
    Dim fd As FileDialog
    Dim vItem As Variant
    Dim mg1 As Range
    Dim mg2 As Range

    Set fd = Application.FileDialog(msoFileDialogFilePicker)
    Set doc = ActiveDocument

    With fd
        .Filters.Add "Images", "*.gif; *.jpg; *.jpeg", 1
        .FilterIndex = 1

        If .Show = -1 Then
            For Each vItem In .SelectedItems
                Set mg2 = ActiveDocument.Range
                mg2.Collapse wdCollapseEnd
                doc.InlineShapes.AddPicture _
                  FileName:=vItem, _
                  LinkToFile:=False, SaveWithDocument:=True, Range:=mg2
                Set mg1 = ActiveDocument.Range
                mg1.Collapse wdCollapseEnd

                mg1.Text = vbCrLF & vbCrLf
            Next vItem
        End If
    End With

    Set fd = Nothing
End Sub

If you don't want to bother with selecting folders or files, you can use an even simpler macro. The following pulls all JPG files from a specified folder and places them in the current document. Each image is in its own paragraph.

Sub GetPictures()
    Dim sPic As String
    Dim sPath As String

    sPath = "c:\myfolder\"
    sPic = Dir(sPath & "*.jpg")

    Do While sPic <> ""
        Selection.InlineShapes.AddPicture _
          FileName:=sPath & sPic, _
          LinkToFile:=False, SaveWithDocument:=True
        sPic = Dir
        Selection.TypeParagraph
        Selection.TypeParagraph
    Loop
End Sub

To use the macro, just make sure you change the value assigned to sPath so that it represents the folder you want.

Note:

If you would like to know how to use the macros described on this page (or on any other page on the WordTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (10726) applies to Microsoft Word 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Word (Word 2007 and later) here: Inserting Multiple Graphics in a Document.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Creating a Spelling Exclusion List

Don't like it when Word always says a word is spelled right and you know that it isn't? Here's how you can fine-tune the ...

Discover More

Comparing Dollar Values in a Conditional Formatting Rule

Comparing values (like is done in conditional formatting rules) can yield some crazy results at times. This tip looks at ...

Discover More

ExcelTips: Powerful Lookup Functions (Table of Contents)

Want to access your data indirectly? The answer is to use Excel's lookup function. ExcelTips: Powerful Lookup ...

Discover More

The First and Last Word on Word! Bestselling For Dummies author Dan Gookin puts his usual fun and friendly candor back to work to show you how to navigate Word 2013. Spend more time working and less time trying to figure it all out! Check out Word 2013 For Dummies today!

More WordTips (menu)

Moving Captions with Pictures

Put a caption with a picture and you'd probably like the two elements to behave like they belong together. If you are ...

Discover More

Nudging a Graphic

If you need to move a graphic just a little bit in one direction or another, you can do so by using the techniques in ...

Discover More

Absolutely Positioning a Graphic

Want a graphic to appear at a precise place on the page? It's easy to gain control by following the steps in this tip.

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is five less than 7?

2022-03-15 19:46:57

Johann

How do i use the last macro here where it is a single image per page. I had tried numerous methods of sendkeys at the end of the loop, insert page break method to the selection object all to no avail. Is there something I am missing?


This Site

Got a version of Word that uses the menu interface (Word 97, Word 2000, Word 2002, or Word 2003)? This site is for you! If you use a later version of Word, visit our WordTips site focusing on the ribbon interface.

Videos
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.