Class Outline (Excel VBA)

The class Outline represents an outline on a worksheet.

Set

To use a Outline class variable it first needs to be instantiated, for example

Dim otl as Outline
Set otl = ActiveSheet.Outline

Outline class variables can be set using the Worksheet.Outline procedure.

AutomaticStyles

True if the outline uses automatic styles.

ActiveSheet.Outline.AutomaticStyles = True

Parent

Returns the parent object for the specified object. Read-only.

ShowLevels

Displays the specified number of row and/or column levels of an outline.

You must specify at least one argument.

ShowLevels (RowLevels, ColumnLevels)

Worksheets("Sheet1").Outline _ 
 .ShowLevels rowLevels:=3, columnLevels:=1

Arguments

The following arguments are optional

RowLevels (Long) - Specifies the number of row levels of an outline to display. If the outline has fewer levels than the number specified, Microsoft Excel displays all the levels. If this argument is 0 (zero) or is omitted, no action is taken on rows.

ColumnLevels (Long) - Specifies the number of column levels of an outline to display. If the outline has fewer levels than the number specified, Excel displays all the levels. If this argument is 0 (zero) or is omitted, no action is taken on columns.

SummaryColumn

Returns or sets the location of the summary columns in the outline.

Possible Values are xlSummaryOnLeft - The summary column will be positioned to the left of the detail columns in the outline, xlSummaryOnRight - The summary column will be positioned to the right of the detail columns in the outline.
ActiveSheet.Outline.SummaryColumn = xlSummaryOnLeft

SummaryRow

Returns or sets the location of the summary rows in the outline.

Possible Values are xlSummaryAbove - The summary row will be positioned above the detail rows in the outline, xlSummaryBelow - The summary row will be positioned below the detail rows in the outline.

Set XlSummaryRow to xlAbove for Microsoft Word-style outlines, where category headers are above the detailed information. Set XlSummaryRow to xlBelow for accounting-style outlines, where summations are below the detailed information.

ActiveSheet.Outline.SummaryRow = xlSummaryAbove