Class Outline (Excel VBA)

The class Outline represents an outline on a worksheet. To use a Outline class variable it first needs to be instantiated, for example


Dim otl as Outline
Set otl = ActiveSheet.Outline

AutomaticStyles

True if the outline uses automatic styles.


ActiveSheet.Outline.AutomaticStyles = True

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

Optional 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 return 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 return 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