Returns or sets the horizontal alignment for the detail footer label in the specified PivotTable list. Read/write PivotHAlignmentEnum .
PivotHAlignmentEnum can be one of these PivotHAlignmentEnum constants. |
plHAlignAutomatic |
plHAlignCenter |
plHAlignLeft |
plHAlignRight |
expression.CaptionHAlignment
expression Required. An expression that returns a PivotTotal object.
Remarks
Captions can be displayed only to the left of aggregates in the detail footer. Use the CaptionHAlignment property to align the caption close to the aggregate (plHAlignRight) or to align the caption close to the left edge of the footer (plHAlignLeft). If there is another aggregate displayed to the left, the caption is displayed to the right of the other aggregate. If there is not enough room to display the caption, it is not visible.
Example
This example formats totals and their captions in the PivotTable1.
Sub Set_Total_Alignment()
Dim ptConstants
Dim vwView
Dim totTotal
Set ptConstants = PivotTable1.Constants
Set vwView = PivotTable1.ActiveView
' Loop through all totals in the view.
For Each totTotal in vwView.DataAxis.Totals
' Set the horizontal alignment of the total to center.
totTotal.HAlignment = ptConstants.plHAlignCenter
' Set the horizontal alignment of the caption to center.
totTotal.CaptionHAlignment = ptConstants.plHAlignCenter
Next
End Sub