如何在 Visual Basic 编辑器中键入 Unicode 货币字符 [英] How to type Unicode currency character in Visual Basic Editor

查看:29
本文介绍了如何在 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 字符串文字.

这篇关于如何在 Visual Basic 编辑器中键入 Unicode 货币字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆