The Zoom Object

A Zoom object represents the magnification properties of a view type: normal, outline, page layout, and so on.

There are two ways to access a Zoom object. The Zoom property of the View object returns the Zoom object that represents the magnification status for the view type associated with that view. If you want to change the magnification properties for the current view type of a particular View object of a particular Pane object, this is the way to do so.

For instance, the following code sets the magnification for the current view type of the active pane to 125%:

	ActiveWindow.ActivePane.View.Zoom.Percentage = 125

(I discuss the Percentage property later in this chapter.)

On the other hand, you can also set up view magnifications for the various view types (normal, outline, page layout, and so on) without reference to the current view in a particular pane. This is done using the Zooms collection, which is accessed using the Zooms property of the Pane object.

The Zooms collection is very static and rather boring. It has no Add or Count methods, and we cannot cycle through the collection using a For Each loop. Nevertheless, the Zooms collection includes a single Zoom object for each view type for the pane, and you can refer to an individual Zoom object in the collection using the constants in the WdViewType enum as an index into the collection. As a reminder, this enum is:

 Enum WdViewType wdNormalView = 1 wdOutlineView = 2 wdPageView = 3 wdPrintPreview = 4 wdMasterView ...

Get Writing Word Macros, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.