How do I get Excel VBA to identify a shape as a picture?
I am asking Excel to count shapes on a worksheet and delete them. The goal is to delete buttons, but it is also a deleting a picture. Is it possible to differentiate between the buttons and picture during its count? The code is as follows:
iCount = ActiveSheet.Shapes.Count
For i = iCount To 1 Step -1
Check the button typename, should catch all and leave validation ranges.
If oleobject then perhaps you will need oleobject but check if thT AFFECTS YOUR PICTURES USING A COPY FIRST.
CHRIS
Sub delShapes()Dim sh As ObjectDim obj As ObjectFor Each sh In ActiveWorkbook.Sheets For Each obj In sh.Shapes Select Case TypeName(obj.DrawingObject) Case "Button", "OLEObject" obj.Delete Case Else End Select Next objNext shEnd Sub
Microsoft Excel topics include formulas, formatting, VBA macros and user-defined functions, and everything else related to the spreadsheet user interface, including error messages.
If oleobject then perhaps you will need oleobject but check if thT AFFECTS YOUR PICTURES USING A COPY FIRST.
CHRIS
Open in new window