Count grouped objects in Visio VBA

417 views Asked by At

I am trying to count the grouped objects in a Visio Display by a certain width.

1

There are 1 answers

1
Adrian Gavrila On
Option Explicit

Public Sub LocationTable()
Dim vsoShapes As Visio.Shapes
Dim vsoShape As Visio.Shape
Dim i As Integer
Dim count As Integer
Dim shpNo As Integer
Dim shapeCount As Integer
Dim shpObj As Visio.Shape, celObj As Visio.Cell
Dim localcent As Single
Dim count2 As Integer


Set vsoShapes = Application.ActiveWindow.Page.Shapes
For shpNo = 1 To Visio.ActivePage.Shapes.count
'For Each vsoShape In vsoShapes
  'shapeCount = vsoShape.Shapes.count
    'For shapeCount = 1 To vsoShape.Shapes.count
    Set shpObj = Visio.ActivePage.Shapes(shpNo)
     If Not shpObj.OneD Then
      If visTypeGroup = 2 Then
        Set celObj = shpObj.Cells("width")
        localcent = celObj.Result("meters")
            If localcent = 0.74 Then
              count = count + 1
              ElseIf localcent = 0.9 Then

              count2 = count2 + 1

             End If
      End If
     'Next shapeCount
     End If
Next shpNo
End Sub