Table of contents
TOC
Collapse the table of content
Expand the table of content

Chart.ChartWizard Method (Project)

office 365 dev account|Last Updated: 6/12/2017
|
1 Contributor

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

NameRequired/OptionalData typeDescription
varSourceOptionalVariantThe 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.
varGalleryOptionalVariantOne of the constants of the Office.XlChartType enumeration, which specifies the chart type.
varFormatOptionalVariantThe 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.
varPlotByOptionalVariantSpecifies whether the data for each series is in rows or columns. Can be one of the following Office.XlRowCol constants: xlRows or xlColumns.
varCategoryLabelsOptionalVariantAn 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.
varSeriesLabelsOptionalVariantAn 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.
varHasLegendOptionalVariantSet True to include a legend.
varTitleOptionalVariantThe chart title.
varCategoryTitleOptionalVariantThe category axis title.
varValueTitleOptionalVariantThe value axis title.
varExtraTitleOptionalVariantThe series axis title for 3-D charts or the second value axis title for 2-D charts.
varSourceOptionalVARIANT
varGalleryOptionalVARIANT
varFormatOptionalVARIANT
varPlotByOptionalVARIANT
varCategoryLabelsOptionalVARIANT
varSeriesLabelsOptionalVARIANT
varHasLegendOptionalVARIANT
varTitleOptionalVARIANT
varCategoryTitleOptionalVARIANT
varValueTitleOptionalVARIANT
varExtraTitleOptionalVARIANT

Return value

Nothing

Remarks

You can 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

Other resources

Chart ObjectAutoFormat Method

© 2018 Microsoft