在Excel VBA中输入特殊字符

时间:2016-01-04 17:46:06

标签: excel excel-vba button character-encoding vba

如何在Excel VBA中输入特殊字符?例如,如果我想在某些字符串中使用“●”(大型交互),它们都显示为“?”。我尝试用VBA中的●替换所有“●”但它不起作用,只是在字符串中显示●

1 个答案:

答案 0 :(得分:1)

参考网站 - Unicode and VBA’s ChrW() and AscW() functions

这里是bullet和强子弹的代码。使用十六进制代替long。

Sub DisplayBullet()
Cells(1, 1).Value = "This is a bullet - " & ChrW(8226)

Cells(2, 1).Value = "This is a strong bullet - " & ChrW(&H25CF)

End Sub

enter image description here

重要提示:如果您尝试在MsgBox中显示它无效。