Answered my own question, after a little more trying.
When I created my macros, Visio put them in a new module called
"NewMacros".
I got the ThisDocument window open and moved everything there, now it
works.
------------------------------
:
Sorry - a followup question:
When I tried the code as given: Dim WithEvents MyWindow As Visio.Window
I get: Compile error: Only valid in object module
I have it right at the top, right under my generic Dims for objects I
reuse
in many functions. I tried both right after the "Option Explicit" and
after
the rest and before the first Sub.
Sorry so many "newbie" questions...
------------------------------
:
Two answers in one! That also shows me how to initialize variables I need
elsewhere! (Which reduces error-checking/correcting code otherwise
needed!)
It also answers a lot of other how-to questions... Like I said in another
post, I'm new to this. I've done some C and more COBOL (in school), but
the
VB there was extremely elementary, and mostly just using the VB graphical
interface, not the text as VBA needs.
Thank you very much!
------------------------------
:
Just more explanation as you work in VBA. Here is the VBA Code :
Dim WithEvents MyWindow As Visio.Window
Private Sub Document_RunModeEntered(ByVal doc As IVDocument)
Set MyWindow = ActiveWindow
End Sub
Private Sub MyWindow_SelectionChanged(ByVal Window As IVWindow)
MsgBox "The selection has changed"
End Sub
Save the document, close and reopen. When the document is opened the
RunModeEntered event fire thus declaring the MyWindow on which you can
further manage events.
------------------------------
"Michael Pollard" <
[email protected]> a écrit dans
le
message de news: (e-mail address removed)...
That's more what I was looking for. Now just to figure out how it works...
Thank you very much.
------------------------------
:
track the SelectionChanged event
------------------------------
"Michael Pollard" <
[email protected]> a écrit dans
le
message de news: (e-mail address removed)...
I want to run a macro (VBA subroutine) when an object is selected. I can
work with this if it works with any object or only with a specific object.
I can get it to work with a doubleclick (EventDblClick), but not
singleclick
or select, at least not without getting into detailed mouse event
processing.
I have a sub that creates a box behind the selected object, making it more
clearly selected. I want to have a different routine on double-click (pull
associated data from a database and display it as custom properties).
Any ideas?