开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜