I need to do some formatting changes in a word document. For which I need to select all Images in the document.
Can someone provide me a macro/option just to select all images in a word document (I am using MS office 2007).
To select multiple objects, press and hold Ctrl while you click or tap the objects that you want. To select text with similar formatting, choose Select All Text with Similar Formatting.
According to your description, please try to right-click the status bar at the bottom of the Word and check the "Selection Mode" option, then check if the "Extended Selection" mode is turned on, if so, you can press ESC to turn it off.
I don't believe there is a simple way to select all images at once unless they are all In Line with Text. If they are, then you can loop them through to make formatting changes using the following example:
Dim iShape As InlineShape
For Each iShape In ActiveDocument.InlineShapes
With iShape
.Width = InchesToPoints(2)
.Height = InchesToPoints(1.5)
End With
Next iShape
I'm not sure if you want to format the pictures or some text around the pictures, but you can do either (or both).
If the images are not all In Line with Text, then you probably want to build something around the following, which moves you to the next graphic:
Selection.GoTo What:=wdGoToGraphic, Which:=wdGoToNext, Count:=1, Name:=""
The difference with this code is that it puts the cursor in front of the next graphic, but it doesn't actually select it, so you would need to add to it. If you wanted to loop through an entire document, here's some code that will do just that. It will find each graphic and type the word "Test" before it... until it finds no more graphics.
Selection.HomeKey unit:=wdStory
Do Until ActiveDocument.Bookmarks("\Sel") = ActiveDocument.Bookmarks("\EndOfDoc")
Selection.GoTo What:=wdGoToGraphic, Which:=wdGoToNext, Count:=1, Name:=""
Selection.MoveRight unit:=wdWord, Count:=1, Extend:=True
If Selection.Type = 7 Then
Selection.Collapse wdCollapseStart
Selection.TypeText Text:="TEST"
Selection.MoveRight unit:=wdWord, Count:=1, Extend:=False
Else
Exit Sub
End If
Loop
It would help if we knew exactly what you were trying to do.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With