Change active page of Vision object in Excel

Martin Novotný 0 Reputation points
2023-01-27T14:30:35.6533333+00:00

I have an Excel document in which I inserted Visio object. It has a few pages, each page has a specific model and according to some checkboxes in excel I want to choose a specific page, so when I print the excel, it will have specific model from visio. All this should do via VBA code that will be trigered by checkmark. The Vision object is embeded in excel, I dont want to link an external document. So far I managed to activate the visio object, with this code:

Set visioObj = Worksheets("Document").OLEObjects("objekt 4")
visioObj.Activate

But I can't figure out, how to change the active page.

Do you have any idea how to do that?

Thank you.

I tried Application.ActivePage and visioObj.ActiveWindow.Page = visioObj.Pages("Strana-3") with no success.

Visio
Visio
A family of Microsoft products used to create diagrams and vector graphics.
100 questions
Excel
Excel
A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
1,955 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Martin Novotný 0 Reputation points
    2023-01-27T22:26:43.0566667+00:00

    Already found an answer, needed to use:
    visioObj.Object.Application.ActiveWindow.Page = vsPage


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.