| VXDSP
Support Notes: Visio Embedded via WebBrowser |
|
Interesting discoveries found through comments of reader Jakub S.
In my sample on page 342, I employed GetObject() to obtain the running instance of Visio, and from their found the active page and so on. Jakub S pointed out that I could have used WebBrowser.Document to obtain a reference direct to the document.
Amongst other benefits, this avoids the problem detailed on page 344, where GetObject may retrieve an instance of Visio that's not the one we want.
As a bonus, I noticed by using VBA's Locals window, that not only does WebBrowser.Document offer a Visio.Document interface, it also offers a Visio.Page interface, getting us directly to the Page that's showing. So for example, :
Dim ADoc As Visio.Document
Dim APage As Visio.Page
Dim AShape As Visio.Shape
Dim NewColor As Integer
Set ADoc = webbrowser.Document
Set APage = webbrowser.Document
If APage Is Nothing Then
MsgBox "No ActivePage"
GoTo done
End If
...returns both a valid Document and Page.
Article Created: 2002-08-08 Last edit: Last edit:
02-08-21 Graham Wideman
Go to: DiagramAntics.com