对Visio VBA中的分组对象进行计数

对Visio VBA中的分组对象进行计数,vba,visio,Vba,Visio,我试图按一定的宽度计算Visio显示中的分组对象。我在一个页面上有许多类型的分组对象,我需要计算一种类型出现的次数,另一种类型出现的次数。为了区分这两种类型,我有两种不同的宽度(0.74和0.9)。我还希望代码排除其他类型的形状。 Option Explicit Public Sub LocationTable() Dim vsoShapes As Visio.Shapes Dim vsoShape As Visio.Shape Dim i As Integer Dim count As In

我试图按一定的宽度计算Visio显示中的分组对象。

我在一个页面上有许多类型的分组对象,我需要计算一种类型出现的次数,另一种类型出现的次数。为了区分这两种类型,我有两种不同的宽度(0.74和0.9)。我还希望代码排除其他类型的形状。
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