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

发布于 2025-01-11 17:22:42 字数 851 浏览 0 评论 0原文

我需要从活动页面上名为“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

I need the get a user defined integer value from the shapes named "CovIBox" on the active page.

What is the correct method?

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

找个人就嫁了吧 2025-01-18 17:22:42

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

在 Visio 中,每个形状都有唯一的名称。您可以迭代每页的所有形状,检查它们的主名称并将感兴趣的形状收集到集合中

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

In Visio each shape have unique name. You mast iterate all shapes per page, check their master name and collect intrested shape to collection

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文