Document load event

X

xargon

Hi everyone,

Newbie question: Is there a document load kind of event that I can use in
VBA for Visio. I basically want to parse the SolutionXML content and
initiallize some variables as soon as my visio document loads. It only has
to work for my Visio document and not for every document the user opens.

Is there a way to implement an event that will be notify my VBA code that
the document has been opened.

Cheers!
xargon
 
A

Al Edlund

you might try something like this
al

' to get document events
Private WithEvents docObj As Visio.Document

Public Sub Document_DocumentOpened(ByVal doc As IVDocument)


On Error GoTo DocumentOpened_Err

Set pagObj = Visio.ActivePage
Set appObj = Visio.Application
Set winObj = Visio.ActiveWindow
Set docObj = Visio.ActiveDocument

' Debug.Print "Document Opened"

' so nothing is selected
ActiveWindow.DeselectAll

' do something to make sure you're at the right place
' do something with your program


Exit Sub

DocumentOpened_Err:

If Err > 0 Then
Debug.Print "Err in DocumentOpenedEvent " & Err & " " & Err.Description
End If


End Sub
 
Top