View Single Post
 
Old 06-16-2020, 11:56 PM
killmenow killmenow is offline Windows 10 Office 2007
Novice
 
Join Date: Jun 2020
Posts: 2
killmenow is on a distinguished road
Default Find all shapes in a document

Hi all

I am new to VBA and new to this forum ("Hello Lawrence")

I have a word document with shapes that I added via the Insert \ Shapes menu entry

Some of the shapes are lines, others are rectangles and some are callouts. I even have a picture or two. (Some are in the header area)

I wanted a script to run through the shapes and select them. I tried this:

Sub FindShapes()
Dim doc As Word.Document, rng As Word.Range
Dim shp As Word.Shape


Set doc = ActiveDocument
Set tot = doc.Shapes

a = tot.Count

For Each shp In doc.Shapes
shp.Select
Debug.Print shp.Type; shp.ID, shp.Name


Next

End Sub


But it does not find all the shapes. In same cases it may find only one shape.

What am I doing wrong?

Thank you

Lawrence
Reply With Quote