Application.ViewApply method (Project)

Applies a view to the active window.

Syntax

expression. ViewApply( _Name_, _SinglePane_, _Toggle_ )

expression A variable that represents an Application object.

Parameters

Name Required/Optional Data type Description
Name Optional String The name of the view to display in the active window.
SinglePane Optional Boolean True if an existing split is removed and the active window displays a single-pane view. The default value is False.
Toggle Optional Boolean True if the active window switches from one pane to two panes, or from two panes to one pane. Toggle is ignored if SinglePane is True. The default value is False.

Return value

Boolean

Remarks

To apply a view where the change can be one of the built-in views and can be applied to a specified pane in a split view, use the ViewApplyEx method.

Example

The following example sets the active window to a single-pane view of the Resource Sheet. It assumes that the active view is a combination of the Gantt Chart and the Task Form details view.

Sub ChangeWindowToResourceSheet() 
 ViewApply Name:="Resource Sheet", SinglePane:=True 
End Sub

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.