Reputation: 49
I'm trying to insert symbol in PowerPoint from FontAwesome icon library. Unicode value example - f001 Here is my code-
Sub InsertSymbol()
Dim txtBox As Shape
Dim s As String
s = "f" & "001"
'Add text box
Set txtBox = Application.ActivePresentation.Slides(1) _
.Shapes.AddTextbox(Orientation:=msoTextOrientationHorizontal, _
Left:=100, Top:=100, Width:=100, Height:=100)
'Add symbol to text box
txtBox.TextFrame.TextRange.InsertSymbol _
FontName:="FontAwesome", CharNumber:=s, Unicode:=msoTrue
End Sub
Error - runtime error 13 Type Misatch. Anyone please could fix this?
Upvotes: 2
Views: 1187
Reputation: 49998
CharNumber
requires a long
- see here.
After a bit of research - your Unicode value "F001"
needs to be converted from hex to decimal. Any online hex to decimal converter will give you the corresponding value 61441
: hex to decimal converter.
Upvotes: 2