Is there a simple ShapeLinkAdded example out there?

Started by XDotNet, April 27, 2012, 02:07:06 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

XDotNet

Hello..i'm looking for a simple sub to listen for the ShapeLinkAdded event. I've done the legwork and every example i've come across doesn't work for me. I've tried the SDK code and everything I could find on the net. I'm using Visio 2010...I can't figure out what i'm missing. When I drag a datarow to a shape the event fires in the "event monitor window" but I can't trap it.

The event sink seems usefult but it doesn't trap this event either. HELP  :)

aledlund

#1
this works for me

al



Option Explicit

Dim WithEvents visApp As Visio.Application
Dim WithEvents visDoc As Visio.Document

'
' so we can call while testing
'
Public Sub initEvents()

Set visApp = Application
Set visDoc = Application.ActiveDocument

End Sub


Private Sub Document_DocumentOpened(ByVal Doc As IVDocument)

Set visApp = Doc.Application
Set visDoc = Doc

End Sub



Private Sub visApp_ShapeLinkAdded(ByVal Shape As IVShape, ByVal DataRecordsetID As Long, ByVal DataRowID As Long)
    Dim visShape As Visio.Shape
    Set visShape = Shape
    Dim drID As Long
    drID = DataRecordsetID
    Dim drRowId As Long
    drRowId = DataRowID
    MsgBox visShape.Name & " drID=" & CStr(drID) & " drRowId=" & CStr(drRowId)
End Sub