如何在Visual Basic编辑器中键入货币符号 [英] How to type currency symbols in Visual Basic Editor
问题描述
有一个项目要求,我们需要检查一个单元格的货币类型.
There is a project requirement where we need to check a cell for its currency type.
我在这个论坛上遇到了类似的问题(如何检查单元格的格式是否设置为货币"?).它说明了如何对$
符号执行此操作.但是我无法在Visual Basic编辑器中将$
符号替换为其他货币符号(例如印度卢比,欧元等).要在VBE中使用其他符号,我尝试了以下方法:
I came across a similar question in this forum (How to check if cell is formatted as Currency?). It explains how to do that for the $
symbol. But I couldn't replace the $
symbol with other currency symbols (for example Indian Rupee, Euro etc.) in Visual Basic Editor. To have other symbols in VBE I have tried the following:
- 使用插入"->符号"选项在Excel中插入符号.
- 复制将符号粘贴到VBE中.
但是它在VBE中粘贴为?
.
But it is pasted as ?
in VBE.
请帮助我在VBE中使用货币符号.如果上述方法不可行,请提出一种识别单元格货币类型的方法.
Please help me to have currency symbols in VBE. If the above is not possible please suggest a way to identify the currency type of a cell.
推荐答案
VBA编辑器不是Unicode.
VBA editor is not Unicode.
为了包含Unicode字符,您需要使用ChrW$
,例如
In order to have Unicode characters in it, you need to use ChrW$
, e.g.
Dim Rupee As String
Rupee = ChrW$(&h20A8&)
另请参见 VBA中的Unicode字符串文字.
这篇关于如何在Visual Basic编辑器中键入货币符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!