Specify Page to display on document open

K

kstalker

Hi all

in Excel there is a VBA function that you can use to specify where you want
the workbook to open at each time the workbook is opened.. e.g.

Private Sub Workbook_Open()
Sheets("Navigation").Select
End Sub

Is there a similar function I can use for a visio document?

Thanks in advance.
 
J

John Goldsmith \(Visio MVP\)

Hello k,

Try this:

Private Sub Document_DocumentOpened(ByVal doc As IVDocument)

End Sub

If you want to see the basic document events, then open the "ThisDocument"
class and select the document object in the left-hand drop down in the VBE
(it normally says "General") and then the right-hand drop down will display
the events.

For more information on using ThisDocument events have a look at this link:

http://msdn.microsoft.com/en-us/library/aa201789(office.10).aspx


Hope that helps.

--
Best regards

John


John Goldsmith (Visio MVP)
www.visualSignals.typepad.co.uk
www.visualSignals.co.uk
 
K

kstalker

Cheers John

I still struggle to see how I can specify the page within the visio
document i want to be displayed when it is opened...

The syntax seems to be quite different to what I am used to. The particular
document i am making reference to has 11 pages and whenever it is opened i
want it to open on the 'Navigation' page regardless of where it was saved
last.

Any advise greatly appreciated.

Kristan
 
J

John Goldsmith \(Visio MVP\)

Hello Kristan,

Sorry, reading too quickly - I missed the bit about setting the page. The
'visible' page is a property of the window object so set as follows:

Private Sub Document_DocumentOpened(ByVal doc As IVDocument)
Dim pag As Visio.Page
For Each pag In Me.Pages
If pag.NameU = "Navigation" Then
ActiveWindow.Page = pag
Exit For
End If
Next pag
End Sub

Hope that helps.

Best regards

John


John Goldsmith (Visio MVP)
www.visualSignals.typepad.co.uk
www.visualSignals.co.uk
 
K

kstalker

Excellent

thanks for your help.

John Goldsmith (Visio MVP) said:
Hello Kristan,

Sorry, reading too quickly - I missed the bit about setting the page. The
'visible' page is a property of the window object so set as follows:

Private Sub Document_DocumentOpened(ByVal doc As IVDocument)
Dim pag As Visio.Page
For Each pag In Me.Pages
If pag.NameU = "Navigation" Then
ActiveWindow.Page = pag
Exit For
End If
Next pag
End Sub

Hope that helps.

Best regards

John


John Goldsmith (Visio MVP)
www.visualSignals.typepad.co.uk
www.visualSignals.co.uk
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top