如何在Visio VBA中获取命名形状的集合



我需要从名为";CovIBox";在活动页面上。

正确的方法是什么?

Private Function GetLastNumber() As Integer
''Need to get the last User Integer property of the shape "CovIBox"
''placed on the active page

Dim oPage As Visio.Page
Dim OColl As Collection
Dim intShapeVal As Integer
Dim IntHighest As Integer
Dim Ival As Integer

Set oPage = Application.ActiveWindow.Page

Set OColl = oPage.Shapes.Name("CovIBox")    <----This where it fails
Ival = 0
For Each Shape In vsoCollection
Ival = Shape.CellsU("Prop.InterfaceNo").value
If Ival > IntHighest Then
IntHighest = Ival
End If
Next

Set OColl = Nothing
Set oPage = Nothing

GetLastNumber = IntHighest + 1

End Function

Set OColl = oPage.Shapes.Name("CovIBox)

在Visio中,每个形状都有唯一的名称。你可以在每页迭代所有形状,检查它们的主名称,并收集插入的形状以收集

最新更新