VBA编辑器中启用Unicode

VBA编辑器中启用Unicode

本文介绍了如何在Excel 2016 VBA编辑器中启用Unicode的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在A1单元格中有一个希伯来语单词שלום"的工作表.

I have a worksheet with Hebrew word "שלום" in cell A1.

我正在尝试运行此VBA代码:

I am trying to run this VBA code:

Sub test()
    Dim str As String
    str = Range("A1")
    MsgBox str
End Sub

消息框显示:

此外,当我尝试用VBA代码编写希伯来语字符时:

Also, when I try to write Hebrew characters in VBA code:

if range("A1") = "שלום" then 'do something...'

我看到的是希伯来字母,而不是希伯来语.

instead of Hebrew letters I see gibberish.

我在Windows 10上使用Excel2016.已安装希伯来语语言包.

I use Excel 2016 on Windows 10. Hebrew language pack is installed.

我在Windows 7的Excel 2010中没有遇到此问题.

I did not face this problem in Excel 2010 on Windows 7.

有人想在VBA代码中启用希伯来语(或通常的Unicode)吗?

Anyone with an idea for enabling Hebrew (or Unicode in general) in VBA code?

推荐答案

您需要将系统区域设置设置为希伯来语.

You need to set system locale to Hebrew.

不同版本的Windows的执行方式略有不同.在网上搜索如何在您的Windows版本上执行此操作.基本上,它在控制面板/语言和地区.如果您使用的是Windows 10,则位于设置/时间"下.语言/地区/其他日期,时间和区域设置(在窗口的右上角)/区域(更改日期,时间或数字格式)/管理性.

Different version of Windows has a slightly different way of doing it. Search the net for how to do it on your version of Windows. Basically, it is in Control Panel/Language & Region. If you are using Windows 10, it is under Settings/Time & Language/Region/Additional Date, Time, & Regional Setting (on the upper right hand corner of the window)/Region (change date, time, or number formats)/Administrative.

这篇关于如何在Excel 2016 VBA编辑器中启用Unicode的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-31 00:21