Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 06-30-2020, 06:32 PM
Guessed's Avatar
Guessed Guessed is offline Remove image placeholders Windows 10 Remove image placeholders Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,185
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

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
When you ask about current selection, there are two possible types of selections relevant to Shapes - because they are 'floating' objects that don't reside in the same layer as the text.

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
Reply With Quote
 



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
Remove image placeholders Removing Placeholders When printing DeadBatteries Word 3 08-23-2012 01:08 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:11 AM.


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