开发者

How do I display a message when clicking on an object in Visio using VBA?

开发者 https://www.devze.com 2022-12-28 05:06 出处:网络
I\'m totally new on this so I want to start with something simple. I have just an object in my Visio document and I want to display a Hello World! message whenever it\'s 开发者_如何学编程clicked.I\'v

I'm totally new on this so I want to start with something simple.

I have just an object in my Visio document and I want to display a Hello World! message whenever it's 开发者_如何学编程clicked.


I've done something similar to this using the SelectionAdded event on the Visio.Application class. I check, if the selection.count is 1, then logically that shape has just been clicked, and if the shape type matches what you want, then display your message:

In the ThisDocument module (any object module, really):

Private WithEvents VsoApp As Visio.Application
Private Sub VsoApp_SelectionAdded(ByVal Selection As IVSelection)
    If Selection.Count = 1 Then
        MsgBox "Hello World"
    End If
End Sub

Hope that helps.

-Jon

0

精彩评论

暂无评论...
验证码 换一张
取 消