LeaderLines Members
Use the LeaderLines
object to control the appearance of the lines connecting data labels to the data points in a series. LeaderLines
are available only for pie chart types. Use the Series
object’s LeaderLines
property to get a reference to this object. LeaderLines
has the following members:
Application Border Creator Delete Name Parent Select
You can select, delete, or change the appearance of LeaderLines
in code. The following code adds data labels and leader lines to a pie chart and makes the leader lines bold:
Sub LeaderLineMembers( ) Dim chrt As Chart, b As Border ' Get the chart. Set chrt = ActiveChart ' Make it a line chart chrt.ChartType = xlPie ' Add data labels with leader lines. chrt.ApplyDataLabels , , , True Set b = chrt.SeriesCollection(1).LeaderLines.Border b.Weight = xlThick End Sub
Tip
Leader lines appear only if you drag the data labels away from the pie chart. You may have to manually drag the data labels away from the pie chart in order for the preceding code to work.
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.