Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 12-01-2020, 08:07 PM
Cendrinne's Avatar
Cendrinne Cendrinne is offline Help with Shape Deletion on Selection only Windows 10 Help with Shape Deletion on Selection only Office 2019
Competent Performer
Help with Shape Deletion on Selection only
 
Join Date: Aug 2019
Location: Montreal Quebec Canada
Posts: 190
Cendrinne is on a distinguished road
Default Help with Shape Deletion on Selection only


Hello Pros,
I need your help again.

Been trying to rack my brain and been trying over and over again, to Delete Shapes from a document, BUT only upon Selection. NOT from the whole document.

Code:
Sub Graph_TEST_LINES_FORME_Supp_On_Select()

ActiveDocument.Select
 For i = ActiveDocument.Shapes.Count To 1 Step -1
    
    ActiveDocument.Shapes(i).Delete
 Next i

End Sub
Is there a way?

Thanks for any insights you may provide

Cendrinne

Last edited by Cendrinne; 12-01-2020 at 10:35 PM.
Reply With Quote
  #2  
Old 12-01-2020, 09:02 PM
Guessed's Avatar
Guessed Guessed is offline Help with Shape Deletion on Selection only Windows 10 Help with Shape Deletion on Selection only Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,932
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

Your ActiveDocument.Select line is selecting everything so any subsequent code would apply to the whole document. Perhaps you are looking for something along the following lines.
Code:
Sub DeleteShapes()
  Do While Selection.Range.ShapeRange.Count > 0
    Selection.Range.ShapeRange(1).Delete
  Loop
End Sub
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #3  
Old 12-01-2020, 10:23 PM
Cendrinne's Avatar
Cendrinne Cendrinne is offline Help with Shape Deletion on Selection only Windows 10 Help with Shape Deletion on Selection only Office 2019
Competent Performer
Help with Shape Deletion on Selection only
 
Join Date: Aug 2019
Location: Montreal Quebec Canada
Posts: 190
Cendrinne is on a distinguished road
Default

OMG, Andew, it Worked.
WOW, I didn't know. Thank you so much. I'm so appreciative
Reply With Quote
Reply

Tags
delete shape on selection

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Shape Data - Using Fixed List selection in another cell's formula natelfo Visio 1 04-22-2019 01:20 PM
How to change size / shape of a shape in a stencil tomgoodell Visio 1 06-30-2016 04:40 AM
Help with Shape Deletion on Selection only Draw a selection box over a shape omberlo PowerPoint 1 11-25-2012 06:44 AM
Tip on File Deletion zyzzyva57 Office 0 01-30-2010 05:33 AM
IMAP Deletion MaxRabbit Outlook 6 10-20-2008 06:33 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:13 PM.


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