Forum Discussion

keldsor's avatar
keldsor
Copper Contributor
Oct 27, 2022
Solved

Finding type of graphic objects WITHOUT selecting ???

I have a sheet with some rectangles, arrows and triangles. Each rectangle has a number as it's Name and when I want to add new rectangles I need to find the biggest 'number' Name allready used and c...
  • HansVogelaar's avatar
    Oct 27, 2022

    keldsor 

    You could use

    Sub IdentifyShapes()
        Dim s As Shape
        For Each s In ActiveSheet.Shapes
            Debug.Print s.Name, s.Type, s.AutoShapeType
        Next s
    End Sub

    For a rectangle, s.Type will be 1 = msoAutoShape, and s.AutoShapeType will be 1 = msoShapeRectangle

Resources