在 Excel VBA 的立即窗口中显示日语文本

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/24219899/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-12 03:27:06  来源:igfitidea点击:

Displaying Japanese text in the Immediate Window of Excel VBA

excelvba

提问by DavidHyogo

In Excel 2010, I have a worksheet containing Japanese text. There is no problem editing, or displaying this. When I grab the value of a cell containing Japanese and use Debug.Print to display it in the Immediate Window it appears as ???? This would be a familiar issue if I was dealing with a browser. I would just make sure everything was in UTF-8 encoding. I have Japanese installed on my English Windows and that's all working fine. In Excel I tried to set the default language to Japanese. I changed the editor font to Arial Unicode but so far I still get question marks. I contacted Microsoft. I was passed from one person to another, but they couldn't help. They offered to pass me to a Technical support person who would charge me 500 US dollars!

在 Excel 2010 中,我有一个包含日语文本的工作表。编辑或显示没有问题。当我获取包含日语的单元格的值并使用 Debug.Print 在立即窗口中显示它时,它显示为 ???? 如果我正在处理浏览器,这将是一个熟悉的问题。我只是确保所有内容都采用 UTF-8 编码。我在我的英文 Windows 上安装了日语,一切正常。在 Excel 中,我尝试将默认语言设置为日语。我将编辑器字体更改为 Arial Unicode,但到目前为止我仍然收到问号。我联系了微软。我从一个人传到另一个人,但他们无能为力。他们提出将我转交给一名技术支持人员,他将向我收取 500 美元!

How can I debug Japanese values in an English version of Excel using the Immediate Window?

如何使用立即窗口在英文版 Excel 中调试日语值?

回答by Gord Thompson

The VBA development environment depends on the Windows "system locale" setting to tell it what character set to use. I got it to work using

VBA 开发环境依赖于 Windows“系统区域设置”设置来告诉它使用什么字符集。我让它工作使用

  • Windows Vista (English)
  • Excel 2010 (English)
  • Windows Vista(英文)
  • Excel 2010(英文)

by going into the "Regional and Language Options" section of the Windows Control Panel and setting the system locale to "Japanese (Japan)"

通过进入 Windows 控制面板的“区域和语言选项”部分并将系统区域设置为“日语(日本)”

jpLocale.png

jpLocale.png

After my system rebooted I could see Japanese characters in the VBA Immediate Window:

系统重新启动后,我可以在 VBA 立即窗口中看到日语字符:

jpVBA.png

jpVBA.png