Page property (Window object)

Microsoft Visio Developer Reference

Page property (Window object)

See also   Example   

Gets or sets the page that is displayed in a window.

Version added

2.0

Syntax

objVariantRet = windowObj.Page
windowObj.Page = stringVariant

objVariantRet

Variant. A Page object that represents the page being shown returned in a Variant.

windowObj

Required. An expression that returns a Window object.

stringVariant

Required Variant. Contains a string that names the page to be shown.

Remarks

If a window is not showing a page (maybe it is showing a master), the Page property returns Nothing. You can use the Type property of the Window object to determine whether the Window object is showing a page. Otherwise, the returned Variant refers to the Page object that the window is showing.

Beginning with Visio 5.0b, the Page property no longer returns an exception if a window is not showing a page—it returns Nothing. You can use the following code to handle both return values.

'Close Window(i) if it is showing a page. 
Set w = Windows(i) 
On Error Resume Next
Set wp = w.Page
On Error GoTo 0
If Not wp Is Nothing Then
    w.Close
End If

Note In versions of Visio through version 4.1, the Page property of a Window object returned an Object (as opposed to a Variant of type Object) and the Page property of a Window object accepted a String (as opposed to a Variant of type String). Due to changes in Automation support tools, the property was changed to accept and return a Variant. For backward compatibility, the PageAsObj and PageFromName properties were added. The PageAsObj and PageFromName properties have the same signatures and occupy the same vtable slots as did the prior version of the Page property.