Adding a Chart Datalabel with a Webding

J

John Michl

I'm pulling my hair out trying to figure this out. I have some VBA
code that adds data labels to a chart. On some of the labels I want to
tack on a symbol of some sort to flag it. (Perhaps using a wingding or
webding font.) I know how to change the font for certain characters in
the data label but can't figure out how to determine how to determine
the proper character code.

For instance, the following will add the Info symbol (i with a circle)
and format it properly. But what if I want to use another symbol from
the character map? How do I determine which letter to use or code as
in Alt+0123? Thanks

- John

===========================================

For i = 1 To pts.Count
pts(i).ApplyDataLabels Type:=xlShowValue
With pts(i).DataLabel
.Text = rngLabels(i, 1) & " " & "i"
End With

With pts(i).DataLabel.Characters(Len(rngLabels(i, 1)) + 2, 10)
.Font.Name = "Webdings"
.Font.FontStyle = "Normal"
.Font.Size = 14
End With
Next i
 
E

Ed Ferrero

Hi John,

Why not build a conversion table for yourself like so?

Sub ShowFont()
Dim i As Integer
Dim rngStart As Range

Set rngStart = Range("A1")

With rngStart
For i = 1 To 255
.Offset(i - 1, 0) = i
.Offset(i - 1, 1) = Chr(i)
.Offset(i - 1, 2) = Chr(i)
.Offset(i - 1, 2).Font.Name = "Webdings"
Next
End With
End Sub

Ed Ferrero
Microsoft Excel MVP
http://www.edferrero.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top