Dimitrie Vatra
asked on
Change the Active Page in visio
Hi!
i'm trying to change between visio pages from code. That means i need to set the VisioApplication.ActivePag e, but it is readonly. So i'm trying to set the VisioApplication.ActiveWin dow.Page.
All good, but when i try that, i get a runtime exception 'Invalid container identifier.'. Anything i tried didn't work. I know that VisioApplication.ActiveWin dow.Page is a dynamic variable in c#. But i still don't know how to handle this exception. My code is :
Globals.ThisAddIn.Applicat ion.Active Window.Pag e = Globals.ThisAddIn.Applicat ion.Active Document.P ages[0];
I need to mention that it is a Visio AddIn project.
Please, i'm trying to fix this out for 2 weeks, and nothing worked. Any help will be really apreciated.
Thanks!
Dimitrie
i'm trying to change between visio pages from code. That means i need to set the VisioApplication.ActivePag
All good, but when i try that, i get a runtime exception 'Invalid container identifier.'. Anything i tried didn't work. I know that VisioApplication.ActiveWin
Globals.ThisAddIn.Applicat
I need to mention that it is a Visio AddIn project.
Please, i'm trying to fix this out for 2 weeks, and nothing worked. Any help will be really apreciated.
Thanks!
Dimitrie
Your line of code above will work, as you've discovered, but it isn't the only way.
ActiveWindow.Page is the correct object and you change active pages from code by equating it to a page name or page reference. For example, assuming that "Page-1" is the first page in the document, all three of these will switch to that page:
ActiveWindow.Page = "Page-1"
ActiveWindow.Page = ActiveDocument.Pages(1)
ActiveWindow.Page = ActiveDocument.Pages("Page -1")
BTW, refer to the very first sample on this page of VBA code samples for Visio.
ActiveWindow.Page is the correct object and you change active pages from code by equating it to a page name or page reference. For example, assuming that "Page-1" is the first page in the document, all three of these will switch to that page:
ActiveWindow.Page = "Page-1"
ActiveWindow.Page = ActiveDocument.Pages(1)
ActiveWindow.Page = ActiveDocument.Pages("Page
BTW, refer to the very first sample on this page of VBA code samples for Visio.
Dimitrie -- when you have a moment, please close the question either by selecting your answer by itself or including mine by clicking "Assisted Solution".
This question needs an answer!
Become an EE member today
7 DAY FREE TRIALMembers can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
ASKER
Globals.ThisAddIn.Applicat