![]() |
|
#2
|
||||
|
||||
|
On your first question, loops that delete items should always start from the back of the line rather than starting from the front. Imagine you have a queue of items where you remove item 3 and step to (the now) item 4. The end effect of this is that your loop skips any item immediately after any item that is deleted.
To avoid this procedural issue, you start from the back Code:
For i = ActiveDocument.Shapes.Count to 1 Step -1 If ActiveDocument.Shapes(i).AutoShapeType = msoShapeRectangle then ActiveDocument.Shapes(i).Delete Next i If you have selected the shapes themselves, you can use Selection.ShapeRange.Count If you have selected the text where some shapes are anchored, this is much more difficult and you would need to loop through all the ActiveDocument.Shapes and test whether their anchor is in the selected text.
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Placeholders | Marina | Word | 9 | 12-17-2019 03:28 PM |
| How do I animate so: small image ==> large image ==> text over overlaid ==> back to next image | ship69 | PowerPoint | 0 | 09-27-2019 12:55 PM |
| Remove image paths from Word to PDF convertion | gwk1975 | Word | 0 | 07-30-2014 05:02 AM |
| Description of Uses/Differences in Placeholders | CathClaud | Mail Merge | 6 | 06-23-2014 06:31 PM |
Removing Placeholders When printing
|
DeadBatteries | Word | 3 | 08-23-2012 01:08 AM |