Visio Guy

Visio Discussions => Programming & Code => Topic started by: fchi on November 30, 2010, 06:00:21 PM

Title: Centering a page in the current window
Post by: fchi on November 30, 2010, 06:00:21 PM
Hi all,

I'm trying to figure out how to center a page in the current window, ideally using a macro.  I've found tons of documentation about centering shapes, but what I'm actually after is zooming the document to 100% and then centering the document within the window (i.e. so both scrollbars are precisely centered). 

I have Visio 2007.

Thanks!
Title: Re: Centering a page in the current window
Post by: wapperdude on November 30, 2010, 09:45:06 PM
Turns out, this is one of those instances where the macro recorder helps.  Here's the result:

Sub CntrPage()

    Application.ActiveWindow.ViewFit = visFitPage

End Sub


You don't need the "application.", just begin with ActiveWindow

Wapperdude
Title: Re: Centering a page in the current window
Post by: fchi on December 13, 2010, 08:48:29 PM
Brilliant!  Thanks so much.