在Powerpoint中通过VBA生成幻灯片的过程中,我需要在生成的文本中插入“ Wingdings符号”,该文本是两个值的比较。我做了这种方法,它完全可以按我的意愿工作
Sub formatDifference(header As String, old As Integer, now As Integer, txt As TextRange)
Dim diff As Integer
diff = old - now
With txt
If (diff > 0) Then
.InsertSymbol "Wingdings", getArrowCharCode("down")
' getArrowCharCode is a custom function to get the
' char code as an Integer
ElseIf (diff = 0) Then
.InsertSymbol "Wingdings", getArrowCharCode("right")
Else
.InsertSymbol "Wingdings", getArrowCharCode("up")
End If
.InsertBefore header & now & " (" ' <-- note this line
.InsertAfter " " & Abs(diff) …Run Code Online (Sandbox Code Playgroud)