Please Note: This article is written for users of the following Microsoft Word versions: 2007, 2010, 2013, 2016, 2019, 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: Determining Picture Size in a Macro.
Written by Allen Wyatt (last updated October 2, 2023)
This tip applies to Word 2007, 2010, 2013, 2016, 2019, and 2021
Word keeps quite a bit of information together about the images that you insert in your documents. This information is necessary so that Word knows how to size, position, and display images. If you want to find out more information about the images in your document, then you need to know something about how Word stores the information.
Images are stored as either of two types of graphic objects: regular shapes or inline shapes. Regular shapes are those that reside on the drawing layer, as opposed to inline shapes, which reside in the text layer. Both types of objects are stored with different object collections. Regular shapes are in the Shapes collection, and inline shapes are stored in the InlineShapes collection. To access information about the objects, you just need to use a little VBA.
The following VBA macro creates a document that displays the size of all the graphics objects within a document, in both points and pixels:
Sub FigureInfo()
Dim iShapeCount As Integer
Dim iILShapeCount As Integer
Dim DocThis As Document
Dim J As Integer
Dim sTemp As String
Set DocThis = ActiveDocument
Documents.Add
iShapeCount = DocThis.Shapes.Count
If iShapeCount > 0 Then
Selection.TypeText Text:="Regular Shapes"
Selection.TypeParagraph
End If
For J = 1 To iShapeCount
Selection.TypeText Text:=DocThis.Shapes(J).Name
Selection.TypeParagraph
sTemp = " Height (points): "
sTemp = sTemp & DocThis.Shapes(J).Height
Selection.TypeText Text:=sTemp
Selection.TypeParagraph
sTemp = " Width (points): "
sTemp = sTemp & DocThis.Shapes(J).Width
Selection.TypeText Text:=sTemp
Selection.TypeParagraph
sTemp = " Height (pixels): "
sTemp = sTemp & PointsToPixels(DocThis.Shapes(J).Height, True)
Selection.TypeText Text:=sTemp
Selection.TypeParagraph
sTemp = " Width (pixels): "
sTemp = sTemp & PointsToPixels(DocThis.Shapes(J).Width, False)
Selection.TypeText Text:=sTemp
Selection.TypeParagraph
Selection.TypeParagraph
Next J
iILShapeCount = DocThis.InlineShapes.Count
If iILShapeCount > 0 Then
Selection.TypeText Text:="Inline Shapes"
Selection.TypeParagraph
End If
For J = 1 To iILShapeCount
Selection.TypeText Text:="Shape " & J
Selection.TypeParagraph
sTemp = " Height (points): "
sTemp = sTemp & DocThis.InlineShapes(J).Height
Selection.TypeText Text:=sTemp
Selection.TypeParagraph
sTemp = " Width (points): "
sTemp = sTemp & DocThis.InlineShapes(J).Width
Selection.TypeText Text:=sTemp
Selection.TypeParagraph
sTemp = " Height (pixels): "
sTemp = sTemp & PointsToPixels(DocThis.InlineShapes(J).Height, True)
Selection.TypeText Text:=sTemp
Selection.TypeParagraph
sTemp = " Width (pixels): "
sTemp = sTemp & PointsToPixels(DocThis.InlineShapes(J).Width, False)
Selection.TypeText Text:=sTemp
Selection.TypeParagraph
Selection.TypeParagraph
Next J
End Sub
Note that the macro returns the names of regular shapes, but not the names of inline shapes. The reason for this is that Word doesn't maintain the names of inline shapes. When you insert a regular shape in your document (again, on the drawing layer), then Word assigns a name to the shape, such as Rectangle 2 or Oval 3.
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 (8343) applies to Microsoft Word 2007, 2010, 2013, 2016, 2019, and 2021. You can find a version of this tip for the older menu interface of Word here: Determining Picture Size in a Macro.
Discover the Power of Microsoft Office This beginner-friendly guide reveals the expert tips and strategies you need to skyrocket your productivity and use Office 365 like a pro. Mastering software like Word, Excel, and PowerPoint is essential to be more efficient and advance your career. Simple lessons guide you through every step, providing the knowledge you need to get started. Check out Microsoft Office 365 For Beginners today!
Word has long allowed you to embed pictures or images in the documents you create. What if you want to get those pictures ...
Discover MoreNeed your hide some of the outside edges of a graphic? You can instruct Word to crop (or hide) those outside edges by ...
Discover MoreInsert a graphic into a document and Word allows you to add a shadow behind the graphic. You can also adjust the ...
Discover MoreFREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)
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 © 2025 Sharon Parq Associates, Inc.
Comments