April 2006
Beginner
1114 pages
98h 16m
English
datalabel AutoText [= setting]
True automatically generates the caption of the data label based on its context; False uses the Caption setting instead. Default is True.
Setting the Caption property automatically sets this property to False. For example, the following code turns off Auto Text by setting the data labels for a series:
Sub SetDataLabels( )
Dim chrt As Chart, sr As Series, dl As DataLabel
Set chrt = ActiveChart
chrt.ChartType = xlColumnClustered
' Get the first series.
Set sr = chrt.SeriesCollection(1)
' Create data labels.
sr.HasDataLabels = True
' Set data label captions.
For Each dl In sr.DataLabels
dl.Caption = sr.Name & ": " & dl.Caption
Next
End SubTo restore Auto Text, set the AutoText property to True:
Sub RestoreAutoDataLabels( )
Dim chrt As Chart, sr As Series
Set chrt = ActiveChart
chrt.ChartType = xlColumnClustered
' Get the first series.
Set sr = chrt.SeriesCollection(1)
' Make sure data labels exist.
sr.HasDataLabels = True
' Restore Auto Text.
sr.DataLabels.AutoText = True
End SubRead now
Unlock full access