Hi BB,
This code seems to work. Try pasting it in a Document class inside the VBA
editor (Alt + F11 will get you there quickly)
If you click the blue-triangle on the Developer toolbar off, then on, the
sub "Document_RunModeEntered" will execute, and set up your WithEvents
m_visApp variable to receive the events.
In this example, the Debug window (Immediate Window) will tell you when
you've selected the Pointer, Line, or Rectangle tool.
-------------------
Private WithEvents m_visApp As Visio.Application
Private Sub Document_RunModeEntered(ByVal doc As IVDocument)
Set m_visApp = ThisDocument.Application
End Sub
Private Sub m_visApp_EnterScope(ByVal app As IVApplication, ByVal nScopeID
As Long, ByVal bstrDescription As String)
If nScopeID = Visio.VisUICmds.visCmdDRLineTool Then
Debug.Print "Line tool selected"
End If
If nScopeID = Visio.VisUICmds.visCmdDRRectTool Then
Debug.Print "Rectangle tool selected"
End If
If nScopeID = Visio.VisUICmds.visCmdDRPointerTool Then
Debug.Print "Pointer tool selected"
End If
End Sub
-------------------
--
Hope this helps,
Chris Roth
Visio MVP
Free Visio shapes:
http://www.visguy.com/category/shapes
Visio programming info:
http://www.visguy.com/category/programming/
Other Visio resources:
http://www.visguy.com/visio-links/