Click here to Skip to main content
15,667,577 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Loop Buttons

Hi Guys 

Thank you in advance ......Could some out there please help me . I am fairly new to excel ........ I am trying to do a loop on all shapes on a active worksheet i got this really cool code that does just that . The problem is "it selects the command Buttons as shapes "  as well. Could someone help me on how to Get only the shapes and not the Ole Objects . Thank you So Much Eric Maxfield 
Sub GetShapeProperties()

Dim sShapes As Shape, lLoop As Long
Dim ws1 As Worksheet

Set ws1 = Worksheets("sheet1")

'Add headings for our lists. Expand as needed

ws1.Range("A1:C1") = _
Array("Shape Name ", "Height", "Width")

'Loop through all shapes on active sheet

For Each sShapes In ws1.Shapes

'Increment Variable lLoop for row numbers

lLoop = lLoop + 1

With sShapes

'Add shape properties

ws1.Cells(lLoop + 1, 1) = .Name
ws1.Cells(lLoop + 1, 2) = .Height 
ws1.Cells(lLoop + 1, 3) = .Width 

'Follow the same pattern for more

End With

The report works well What i would like to achieve is Getting rid of the buttons in the loop 

My report shows 
button 1 
button 2 
command buttons you know 
ZurdoDev 13-Dec-13 21:00pm    
I would use the debugger and see what properties are available. There may a property to indicate shape types.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900