计算Visio VBA中的分组对象

时间:2015-06-19 11:00:56

标签: vba visio

我正在尝试将Visio显示中的分组对象计算一定的宽度。

1 个答案:

答案 0 :(得分:0)

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