vba - Counting shapes by name in Visio -
i want count different types of shapes in diagram, , can't seem done. think have code that. use visio 2007 that.
i have flow chart process shapes want distinguish name. e.g "type a", "type b". , @ end, want have list tells me how used type , type b. counting hand error prone.
i checked out report/statistic function (i'm using in german, i'm afraid can't tell exact menu name), can define report function yourself, although 1 misses features needs. managed make report shapes, when selected. when user has select them hand, can count them right start... , have make 4-5 clicks in order static report result.
another useful function found layer method: create layer types want count, , assign shapes layer. but, again, error prone. if user misses shape, count wrong.
so think need code vba. additionally, i'd have text field next diagram resulting counts types displayed. see when add shape of type count goes one.
could me on this?
try:
option explicit dim myshape shape sub shapesdetails() call deleteshapes(true) activesheet.shapes.addshape(msoshaperectangle, 139.5, 81.75, 72, 72).select selection.name = "rectangle" activesheet.shapes.addshape(msoshapesmileyface, 252.75, 71.25, 72, 72).select selection.name = "smiley face" application.cutcopymode = false call shapedetails(true) end sub sub shapedetails(x boolean) each myshape in activesheet.shapes msgbox "shape name: " & myshape.name & vbtab & " shape type: " & myshape.type next end sub sub deleteshapes(x boolean) each myshape in activesheet.shapes myshape.delete next end sub
Comments
Post a Comment