Visio - Page Size

I didn't see a Visio section, but I am using C#, so hopefully this is a good spot to post this question.  I need to set the drawing scale in visio, but I don't see how to programatically do that.  After that is done, I also need to get the page width and height (this is what you see in the Page Setup, Drawing Scale tab in Visio).

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Have you tried recording a macro in Visio to do this and studied the VBA?  When I did, I got the following:

    Application.ActivePage.PageSheet.CellsSRC(visSectionObject, visRowPage, visPageWidth).FormulaU = "200 mm"
    Application.ActivePage.PageSheet.CellsSRC(visSectionObject, visRowPage, visPageHeight).FormulaU = "300 mm"
    Application.ActivePage.PageSheet.CellsSRC(visSectionObject, visRowPage, visPageScale).FormulaU = "10 mm"
    Application.ActivePage.PageSheet.CellsSRC(visSectionObject, visRowPage, visDrawingScale).FormulaU = "200 mm"

I expect you could port this easily using the Visio COM object...



Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ctjoumasAuthor Commented:
I actually got this to work yesterday and forgot to close this out.  Your answer is pretty much what I am using, so I will give you the points.  For anyone else that is interested, I used it like this (height in this example):

                  string strPageHeight = visioPage.PageSheet.get_CellsSRC(
                        (short) Visio.VisSectionIndices.visSectionObject,
                        (short) Visio.VisRowIndices.visRowPage,
                        (short) Visio.VisCellIndices.visPageHeight ).FormulaU;

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.