Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 06-16-2020, 11:56 PM
killmenow killmenow is offline Find all shapes in a document Windows 10 Find all shapes in a document Office 2007
Novice
Find all shapes in a document
 
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
 

Tags
shapes



Similar Threads
Thread Thread Starter Forum Replies Last Post
Find all shapes in a document Find several words in document, copy paragraph and create new document coolio2341 Word VBA 6 01-31-2019 01:17 PM
Find This Or That On Line Six of Word Document StephenRay Word VBA 33 09-29-2017 02:01 PM
Find all shapes in a document Won't find Word document wblock@cnu.edu Word 4 08-23-2017 06:11 PM
Find all shapes in a document Does a document need to find original template? PatrickYork Word 1 01-05-2012 04:12 AM
Find all shapes in a document Find and add new Shapes bonani PowerPoint 1 11-26-2009 06:21 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:20 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft