Sometimes when you create international Excel VBA applications that are used worldwide, you may want to take extra steps to translate critical program messages to the language used by the local users. In this article, you will be walked through the process of showing foreign characters in Visual Basic Editor.
|
Caveats In Visual Basic Editor
The Visual Basic Editor does not support Unicode encoding, neither for input, nor for display. Instead, VBE uses a legacy Windows technology of the nineties called ANSI code pages to provide support for international ASCII characters. Windows code pages were gradually superseded when Unicode was implemented in Windows, although they are still supported, both within Windows and other platforms.
The character encoding in the VBE corresponds to the code page that is used by the Windows system locale as specified in the Region under control panel. If you try to enter Chinese characters in VBE in any English version of Office (USA, UK etc), you will get a string of question marks '????????', even if a Chinese keyboard is available under your language preferences.
To use the Chinese language in VBA:
The character encoding in the VBE corresponds to the code page that is used by the Windows system locale as specified in the Region under control panel. If you try to enter Chinese characters in VBE in any English version of Office (USA, UK etc), you will get a string of question marks '????????', even if a Chinese keyboard is available under your language preferences.
To use the Chinese language in VBA:
- Open Control Panel
- Click Region
- Click the Administrative tab
- Click the Change system locale button
- Select which language to use when displaying text in programs, such as VBE, that do not support Unicode. The setting will affect all user accounts on your computer.