AutoFit Property

Microsoft Office Web Components Visual Basic

and MaxWidth properties. The default value is True. If the AutoFit property is set to False, the overall size of the spreadsheet or PivotTable list is set based on its Width and Height properties. Read/write Boolean.

PivotAxisMember or PivotTotal objects: True if the width of the total is set automatically. The default value is True. When this property is set to True, any layout change also updates the Width and Height property values. When you change the Width and Height values programmatically, the value of the AutoFit property is set to False. Read/write Boolean.

expression.AutoFit

expression    Required. An expression that returns one of the objects in the Applies To list.

Example

This example disables automatic sizing for the PivotTable list and then sets its width.

Note  The object property of the OBJECT HTML element is used to access the Width property of the PivotTable object (PivotTable1.Object.Width) because the OBJECT element on an HTML page also has its own Width property. This is not necessary when a PivotTable control is on a user form or other ActiveX container.

Sub DisableAutoFit()

   PivotTable1.AutoFit = False
   PivotTable1.Object.Width = 8000

End Sub