Compartilhar via


View.Type Property

Word Developer Reference

Returns or sets the view type. Read/write WdViewType.

Syntax

expression.Type

expression   Required. A variable that represents a View object.

Remarks

The Type property returns wdMasterView for all documents where the current view is an outline or a master document. The current view will never return wdOutlineView unless explicitly set first in code.

To check whether the current document is an outline, use the Type property and the Subdocuments collection's Count property. If the Type property returns either wdOutlineView or wdMasterView and the Count property returns zero, the document is an outline. For example:

Visual Basic for Applications
  Sub VerifyOutlineView()
    With ActiveWindow.View
        If .Type = wdOutlineView Or wdMasterView Then
            If ActiveDocument.Subdocuments.Count = 0 Then
                .
                .
                .
            End If
        End If
    End With
End Sub

Example

This example switches the active window to print preview. The Type property creates a new print preview window.

Visual Basic for Applications
  ActiveDocument.ActiveWindow.View.Type = wdPrintPreview

See Also