Activate page

P

peter.allan

Hello all,

I'm using the following code to loop through all pages in my org chart
and re-layout ;

For Each visPage In visDoc.Pages
Call visApp.Addons.ItemU("OrgC11").Run("/cmd=LayoutPage")
Next visPage

Unfortunately this doesn't work - it will only run the re-Layout on
the active page (ie. the one I am looking at on the screen.

So how do I change the active page using VBA in Visio 2003 ? I found
some examples here which use the following ;

ActiveWindow.Page = visPage.Name

but there is no Page property of the ActiveWindow in Visio 2003,
although it is there in Visio 2002.

Can anyone tell me how to programmatically change the active page ?

Thanks,
Peter
 
P

Paul Herber

Hello all,

I'm using the following code to loop through all pages in my org chart
and re-layout ;

For Each visPage In visDoc.Pages
Call visApp.Addons.ItemU("OrgC11").Run("/cmd=LayoutPage")
Next visPage

Unfortunately this doesn't work - it will only run the re-Layout on
the active page (ie. the one I am looking at on the screen.

So how do I change the active page using VBA in Visio 2003 ? I found
some examples here which use the following ;

ActiveWindow.Page = visPage.Name

but there is no Page property of the ActiveWindow in Visio 2003,
although it is there in Visio 2002.

Can anyone tell me how to programmatically change the active page ?

Should work fine. Have you done
dim visPage as Page
 
J

JuneTheSecond

in my system Visio2003 has ActiveWindow.Page property.
And ActiveWindow.Page = visPage turns page.
not ActiveWindow.Page = visPage.Name
 
P

peter.allan

Hi folks,

Thanks for the pointers. However it still does not work on my system.
Here is my code in its entirety ;

Public Sub test()
Dim visDoc As visio.Document
Dim visApp As visio.Application
Dim visPage As visio.Page

Set visApp = CreateObject("visio.application")
Set visDoc = visApp.Documents.Open("filename.vsd")

For Each visPage In visDoc.Pages
ActiveWindow.Page = visPage.Name

Next visPage

End Sub

The code falls over at the ActiveWindow.Page = vispage.Name line with
an error 438 - "object does not support this property". It makes no
difference if I use vispage.name, or just vispage. Also when I am
writing the code, intellisense does not offer the 'page' property when
I type "ActiveWindow."

Could there be a reference missing ? I have selected all 3 available
Microsoft Visio references - Type, Drawing Control Type and Save As
Web type.

Does anyone have any other suggestions ?

Thanks,
Peter.
 
J

JuneTheSecond

try visApp.ActiveWindow.Page = visPage,
in place of ActiveWindow.Page = visPage.Name.
 
P

peter.allan

Hi all,

Managed to resolve this problem by changing

Activewindow.page

to

Visapp.Activewindow.page

Thanks for help,
Peter.
 

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