Please Note: This article is written for users of the following Microsoft Word versions: 2007, 2010, 2013, 2016, 2019, Word in Microsoft 365, and 2021. If you are using an earlier version (Word 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Word, click here: Inserting Multiple Graphics in a Document.
Written by Allen Wyatt (last updated May 27, 2023)
This tip applies to Word 2007, 2010, 2013, 2016, 2019, Word in Microsoft 365, and 2021
Every week John needs to create an invoice and insert several scanned documents 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:
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 5. The point is that whatever files you have selected in step 5, those are the files that Word inserts in your document.
A variation on this approach involves the use of Windows. Follow these general steps:
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:
WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (10727) applies to Microsoft Word 2007, 2010, 2013, 2016, 2019, Word in Microsoft 365, and 2021. You can find a version of this tip for the older menu interface of Word here: Inserting Multiple Graphics in a Document.
Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!
Need to duplicate a drawing object? It's easy to do if you use the same editing techniques you are already familiar with.
Discover MoreIf you want to "sign" your documents, you might be tempted to insert a graphic scan of your signature into them. Before ...
Discover MoreWhen you print a graphic that includes a gradient, you may not get exactly the output you expect. This tip examines two ...
Discover MoreFREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
2023-05-29 22:49:25
sunny
Thanks for very useful information. However, to facilitate Microsoft Community to view in one screen, I have to enlarge text-description of Actions and Software versions and shrink not-so-essentials (Images, Date-Time, User Instructions, Warnings).
Is there shortcut or VBA for such to facilitate Microsoft Technical Support?
Thanks Ahead!
2023-05-29 00:32:56
Tomek
Further to my earlier comment:
The pictures were inserted without overlapping after I changed the setting "Insert /paste pictures as:" to "in line with text" in Advanced options. My default setting was "Square", as this is how I usually want my pictures inserted. The Microsoft default setting is most likely "in line".
2023-05-29 00:23:49
Tomek
Further to my earlier comment:
The pictures were inserted without overlapping after I changed the setting "Insert /paste pictures as:" to "in line with text"
2023-05-29 00:20:28
Tomek
I inserted six pictures into an empty documents following the first tip. Although all pictures got inserted, they all overlapped on a single page. Only one of them was fully visible and three of them were completely hidden. I could move them manually to different pages (after adding the pages first), but it wouldn't be practical with many more pictures.
Also, all the pictures were inserted with the "Allow Overlap" checked. Is there a way to make the inserted pictures set o not allow overlapping?
Having said that, unchecking the "Allow Overlap" check box for all pictures that were inserted, did not prevent them from overlapping - that setting was ignored by Word when pictures were too big to not overlap on a single page.
Got a version of Word that uses the ribbon interface (Word 2007 or later)? This site is for you! If you use an earlier version of Word, visit our WordTips site focusing on the menu interface.
Visit the WordTips channel on YouTube
FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2024 Sharon Parq Associates, Inc.
Comments