Chart.ChartWizard method (Project)

Modifies the properties and formatting of a chart.

Syntax

expression. ChartWizard (varSource, varGallery, varFormat, varPlotBy, varCategoryLabels, varSeriesLabels, varHasLegend, varTitle, varCategoryTitle, varValueTitle, varExtraTitle)

expression A variable that represents a Chart object.

Parameters

Name Required/Optional Data type Description
varSource Optional Variant The source data for a new chart. If the varSource argument is omitted, Project edits the active report or the selected chart on the active report.
varGallery Optional Variant 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.
varPlotBy Optional Variant Specifies whether the data for each series is in rows or columns. Can be one of the following Office.XlRowCol constants: xlRows or xlColumns.
varCategoryLabels Optional Variant An integer that specifies the number of rows or columns within the source range that contain category labels. Values can be from 0 (zero) through one less than the maximum number of the corresponding categories or series.
varSeriesLabels Optional Variant An integer that specifies the number of rows or columns within the source range that contain series labels. Values can be from 0 (zero) through one less than the maximum number of the corresponding categories or series.
varHasLegend Optional Variant Set True to include a legend.
varTitle Optional Variant The chart title.
varCategoryTitle Optional Variant The category axis title.
varValueTitle Optional Variant The value axis title.
varExtraTitle Optional Variant The series axis title for 3D charts or the second value axis title for 2D charts.
varSource Optional Variant
varGallery Optional Variant
varFormat Optional Variant
varPlotBy Optional Variant
varCategoryLabels Optional Variant
varSeriesLabels Optional Variant
varHasLegend Optional Variant
varTitle Optional Variant
varCategoryTitle Optional Variant
varValueTitle Optional Variant
varExtraTitle Optional Variant

Return value

Nothing

Remarks

Use the ChartWizard method to quickly format a chart without setting all the individual properties. This method is noninteractive, and it changes only the specified properties. TheAutoFormat method can do the same job as a call to ChartWizard that uses only the varGallery and varFormat parameters.

If the Source parameter is omitted and the selection isn't an embedded chart on the active report, or the active report does not contain a chart, the ChartWizard method fails and an error occurs.

Example

The following example reformats the chart on the active report as a line chart, adds a legend, and adds category and value axis titles.

Sub TestChartWizard()
    Dim chartShape As Shape
    Dim reportName As String
    
    reportName = "Simple scalar chart"
    Set chartShape = ActiveProject.Reports(reportName).Shapes(1)
    
    chartShape.Chart.ChartWizard varGallery:=xlLine, varHasLegend:=True, varCategoryTitle:="Task", varValueTitle:="Hours"
End Sub

See also

Chart Object AutoFormat 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.