Orientation Property

Applies To

AxisTitle Object, Button Object, Buttons Collection, ChartTitle Object, DataLabel Object, DataLabels Collection, DrawingObjects Collection, GroupObject Object, GroupObjects Collection, PageSetup Object, PivotField Object, Range Object, Style Object, TextBox Object, TextBoxes Collection, TickLabels Object.

Description

Returns or sets the object's orientation, as shown in the following table.

Object

Orientation

PageSetup

Portrait or landscape printing mode. One of xlPortrait or xlLandscape.

PivotField

Location of the field in the PivotTable. One of xlHidden, xlRowField, xlColumnField, xlPageField, or xlDataField.

AxisTitle, Button, ChartTitle, DataLabel, DrawingObjects, GroupObject, RadarAxisLabels, Range, Style, TextBox, TickLabels

The text orientation. One of xlHorizontal, xlVertical, xlUpward, or xlDownward. Can also be xlAutomatic for TickLabels only.


Example

This example displays the orientation for the field named "ORDER_DATE."


Set pvtTable = Worksheets("Sheet1").Range("A3").PivotTable
Set pvtField = pvtTable.PivotFields("ORDER_DATE")
Select Case pvtField.Orientation
    Case xlHidden
        MsgBox "Hidden field"
    Case xlRowField
        MsgBox "Row field"
    Case xlColumnField
        MsgBox "Column field"
    Case xlPageField
        MsgBox "Page field"
    Case xlDataField
        MsgBox "Data field"
End Select

This example sets Sheet1 to print in landscape orientation.


Worksheets("Sheet1").PageSetup.Orientation = xlLandscape