如何在 Visual Basic 编辑器中键入 Unicode 货币字符

问题描述:

有一个项目要求,我们需要检查单元格的货币类型.

There is a project requirement where we need to check a cell for its currency type.

我在这个论坛上遇到了一个类似的问题(How检查单元格格式是否为货币?).它解释了如何为 $ 符号做到这一点.但是我无法在 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 字符串文字.