ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Adding a Chart Datalabel with a Webding (https://www.excelbanter.com/excel-programming/349530-adding-chart-datalabel-webding.html)

John Michl

Adding a Chart Datalabel with a Webding
 
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


Ed Ferrero

Adding a Chart Datalabel with a Webding
 
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

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




John Michl

Adding a Chart Datalabel with a Webding
 
Neat idea. Thanks. - John



All times are GMT +1. The time now is 12:04 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com