Chart.AutoFormat method (Project)
Changes the chart to a default format for another chart type.
Syntax
expression. AutoFormat
(rGallery, varFormat)
expression A variable that represents a Chart object.
Parameters
Name | Required/Optional | Data type | Description |
---|---|---|---|
rGallery | Required | Long | One of the constants of the Office.XlChartType enumeration, which specifies the chart type. |
varFormat | Optional | Variant | The option number for the built-in autoformats. Can be a number from 1 through 10, depending on the gallery type. If the varFormat argument is omitted, Project chooses a default value based on the gallery type and data source. |
rGallery | Required | INT32 | |
varFormat | Optional | Variant |
Return value
Nothing
Remarks
The ChartWizard method can do the same job as the AutoFormat method, although ChartWizard has more options.
Example
The following example changes the chart to the default 3D Stacked Area format.
Sub TestAutoFormat()
Dim chartShape As Shape
Dim reportName As String
reportName = "Simple scalar chart"
Set chartShape = ActiveProject.Reports(reportName).Shapes(1)
chartShape.Chart.AutoFormat Office.XlChartType.xl3DAreaStacked
End Sub
See also
Chart Object ChartWizard Method
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.