S
SamW
I am trying to custom format datalabels in a chart, for example if a
DataLabel says 12%. I want to change it to say 12% A.
This is fine, I have code (I'm actually using C# to develop but I made it
into VBA code because I think it is clearer for this forum):
ActiveSheet.ChartObjects("Chart 1").Activate
Set point = ActiveChart.SeriesCollection(6).Points(1)
point.DataLabel.Text = point.DataLabel.Text & " A"
I saw similar code here too
(http://peltiertech.com/Excel/Charts/ScientificNotation.html).
This setting of the size on a given range of text within the label is not
working for me, it is simply setting the formatting on the entire label.
I know that this is notionally possible, you can manually in
Excel/PowerPoint etc. select a range of text within a data label and change
the formatting okay. It is just that the API seems faulty, or I am
misunderstanding the API somehow?
This part works fine. However I want to set a different text format on the
A. So I try:
Dim chars As Characters
Set chars =
point.DataLabel.Characters(Len(point.DataLabel.Characters.Text), 1)
chars.Font.Size = 7
DataLabel says 12%. I want to change it to say 12% A.
This is fine, I have code (I'm actually using C# to develop but I made it
into VBA code because I think it is clearer for this forum):
ActiveSheet.ChartObjects("Chart 1").Activate
Set point = ActiveChart.SeriesCollection(6).Points(1)
point.DataLabel.Text = point.DataLabel.Text & " A"
I saw similar code here too
(http://peltiertech.com/Excel/Charts/ScientificNotation.html).
This setting of the size on a given range of text within the label is not
working for me, it is simply setting the formatting on the entire label.
I know that this is notionally possible, you can manually in
Excel/PowerPoint etc. select a range of text within a data label and change
the formatting okay. It is just that the API seems faulty, or I am
misunderstanding the API somehow?
This part works fine. However I want to set a different text format on the
A. So I try:
Dim chars As Characters
Set chars =
point.DataLabel.Characters(Len(point.DataLabel.Characters.Text), 1)
chars.Font.Size = 7