ChartWrapCount Property

Microsoft Office Web Components Visual Basic

Returns or sets the number of charts that are placed horizontally or vertically before wrapping occurs. For a more complete discussion of layout and wrapping, see the Help topic for the ChartLayout property. Read/write Long.

expression.ChartWrapCount

expression    Required. An expression that returns a ChartSpace object.

Example

This example sets the ChartWrapCount and ChartLayout properties and then adds six additional charts to the specified chart workspace.

Sub AddCharts()
    Dim chtChart
    Dim chConstants
    Dim iCtr
     
    Set chConstants = ChartSpace1.Constants
    
    ' Set the chart workspace so that a row or column
    ' of charts is created for every two charts
    ' in the chart workspace.
    ChartSpace1.ChartWrapCount = 2
    
    ' Set the chart workspace so that the charts are laid our horizontally.
    ' Since this code adds six charts to the chart workspace and the 
    ' ChrtWrapCount property has been set to wrap every two charts,
    ' then the code results in three rows of two charts.
    ChartSpace1.ChartLayout = chConstants.chChartLayoutHorizontal
    
    For iCtr = 1 To 6
        ' Add a chart to the chart workspace.
        Set chtChart = ChartSpace1.Charts.Add
        
        ' Enable the chart title.
        chtChart.HasTitle = True
        
        ' Add a title to the chart that indicates the order
        ' in which the chart was created.
        chtChart.Title.Caption = "Chart # " & iCtr
        
        ' Specify that the chart is to be a line chart.
        chtChart.Type = chConstants.chChartTypeLine        
    Next    
End Sub