DropLines and HiLoLines Members

Use the DropLines and HiLoLines objects to control the appearance of those items on a chart. Use the ChartGroup object’s DropLines, and HiLoLines properties to get a reference to these objects. These objects have the following members:

Application
Border
Creator
Delete
Name
Parent
Select

The DropLines and HiLoLines objects provide a small set of programmable features. You can select, delete, or change the appearance these lines. Be sure to check the ChartGroup object’s Has xxx property before using any of these objects.

The following code uses the Border property to set the weight, color, and style of the drop lines on a line chart:

Sub FormatDropLines( )
    Dim chrt As Chart, cg As ChartGroup, bd As Border
    ' Get the chart.
    Set chrt = ActiveChart
    ' Set the chart type
    chrt.ChartType = xlLineStacked
    ' Get the chart group.
    Set cg = chrt.LineGroups(1)
    ' Turn on drop lines
    cg.HasDropLines = True
    ' Get the drop line's border
    Set bd = cg.DropLines.Border
    ' Format the lines
    bd.Weight = 4
    bd.Color = &HFF0000
    bd.LineStyle = xlLineStyle.xlDot
End Sub

Get Programming Excel with VBA and .NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.