Delete all pictures from worksheet but not Form Controls

dimitri

Board Regular
Joined
Nov 8, 2010
Messages
78
Hi,
I'm looking for a bit of code that will allow me to delete all the pictures on a given worksheet without deleting the command buttons. Thanks.
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Give this macro a try...

Code:
Sub ClearPicturesOnly()
  Dim SH As Shape
  For Each SH In ActiveSheet.Shapes
    If SH.Type = msoPicture Then SH.Delete
  Next
End Sub
 
Upvote 0
Another way:
Code:
activesheet.pictures.delete
 
Upvote 0
Another way:
Code:
activesheet.pictures.delete
????

Okay, I see that statement works, but why? Pictures does not show up in VB's intellisense for a worksheet. Admittedly I only did a quickish search, but I can find no reference to a Pictures collection (or object for that matter, although objects do not usually take an "s" on the end of their names) anywhere within VB's help files (XL2003). Where is Pictures documented at? Or is this simply an undocumented collection that someone once tripped across?
 
Upvote 0
Right-click in an object browser window and select View hidden members to see lots of other collections -- Buttons, Drawings, DropDowns, GroupBoxes, Labels, ...
 
Upvote 0
Right-click in an object browser window and select View hidden members to see lots of other collections -- Buttons, Drawings, DropDowns, GroupBoxes, Labels, ...
All these years (both during my Excel time and my time before in the compiled VB world) and I never really played much with the Object Browser. Thanks for opening my eyes. Oh, and a side effect that I just noticed... setting the Show Hidden Members option in the Object Browser window makes the hidden members now show up in intellisense for the objects to which they apply.
 
Upvote 0

Forum statistics

Threads
1,224,560
Messages
6,179,519
Members
452,921
Latest member
BBQKING

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top