PowerPoint VBA - 使用宏插入符号
PowerPoint VBA - Insert Symbol using macro
我正在尝试从 FontAwesome 图标库中在 PowerPoint 中插入符号。
Unicode 值示例 - f001
这是我的代码-
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
错误 - 运行时错误 13
类型不匹配。
有人可以解决这个问题吗?
CharNumber
需要 long
- 请参阅 here。
经过一些研究 - 您的 Unicode 值 "F001"
需要从十六进制转换为十进制。任何在线的十六进制到十进制转换器都会为您提供相应的值 61441
:hex to decimal converter.
我正在尝试从 FontAwesome 图标库中在 PowerPoint 中插入符号。 Unicode 值示例 - f001 这是我的代码-
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
错误 - 运行时错误 13 类型不匹配。 有人可以解决这个问题吗?
CharNumber
需要 long
- 请参阅 here。
经过一些研究 - 您的 Unicode 值 "F001"
需要从十六进制转换为十进制。任何在线的十六进制到十进制转换器都会为您提供相应的值 61441
:hex to decimal converter.