Unicode Language Support in the VBA editor - excel

I have a VBA project in Excel 2003.
This VBA project was written in Russian using Cyrillic encoding, so all the comments and messages are unreadable on my English OS (WindowsXP).
so the code on Russian machine looking like (OK):
Sub Select_I()
'Выделяет по текущей ячейке "построчный" диапазон для ввода данных по объекту
become on mine (NOT OK)
Sub Select_I()
'Âûäåëÿåò ïî òåêóùåé ÿ÷åéêå "ïîñòðî÷íûé" äèàïàçîí äëÿ ââîäà äàííûõ ïî îáúåêòó
Is there a way to "indicate" to the VBA editor what encoding to use?

I've found a workaround for me - when copy-paste Russian text from VBA editor to somewhere else in Windows and keyboard at that moment is in Russian layout, then pasted Russian symbols are displayed correctly.

Try the following (I cannot test this very easily but it should work):
Control Panel --> Date, Time, Language, and Regional Options --> Regional and Language Options --> Advanced
and set the language for non-Unicode programs to the appropriate language (Russian it seems in your case).

Related

How to display Japanese characters in VBA editor?

I can't set Sheet.Name property in Japanese. Event file name also displays in maybe Chinese? All display well in Excel.
How can I set up the VBA editor to work with Japanese?
I changed region to Japanese.
Finally, I got to the right point.
this post is in Japanese but by picture so not hard to see that in Admitration we must uncheck [Header: World Wide language support ... use Unicode UTF-8]
maybe as #stifin mentioned, it is about wide character.
Answer

MSKLC under Windows 10: Create custom keyboard layout which supports IME (input method) for Chinese and combined input in Spanish

This question is originally posted by me in Microsoft Community at:
https://answers.microsoft.com/en-us/windows/forum/windows_10-other_settings/msklc-under-windows-10-create-custom-keyboard/8c5a7137-d575-4247-8ab3-b4dd1e5fb437?tm=1495318604424
In summary: I have created a custom keyboard layout with Microsoft Keyboard Layout Creator 1.4 in Windows 10, it is working but only partially. It cannot:
combine two keystrokes into one to type a "combined letter", e.g, "¨"+"u" = "ü". It should not exist in Chinese but I want to achieve this.
type Chinese pinyin and Chinese punctuation. In MS pinyin IME, I can press shift to switch between Chinese pinyin mode and English mode. Under pinyin mode I can convert letters into pinyin and thus get Chinese characters, but my layout lacks this. And, if I press "," in Microsoft Pinyin in pinyin mode, it should give me ","(full length comma), but this layout is not able to do this.
I am thinking about two ways to solve this:
Substitute Microsoft Pinyin's keyboard layout to my layout(replace the English part of MS Pinyin with my layout)
Copy the pinyin part of MS pinyin to my layout.
So, how can I solve this?
I have solved it.
For the first problem, you must define some "dead keys combinations". The details are explained here:
http://www.angelfire.com/planet/linguisticsisfun/Creating_a_Keyboard_Using_MSKLC.pdf
For the second problem, basically you do:
Create your keyboard layout.
Edit the .klc file with a Text Editor, to change the VK code mapping. That is because most of the applications in Microsoft Windows, when you press the hotkeys, detects VK code sent to OS, not the "key chars"(the characters output as you type in a text processing software). So in order to make the key chars of your keyboard layout to match with their VK code, you must do this manually. MSKLC will not change that for you. Some details here:
http://www.sensefulsolutions.com/2010/08/how-to-fix-keyboard-shortcuts-in-klc-eg.html
Install the layout.
Open your registry editor, enter HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layouts\, find your new keyboard layout at the bottom (mine with name like a0000xxxx). Copy the dll file name. That is the DLL file containing your newly created keyboard layout info.
Go back to the registry father branch, search the language you want to apply this layout, like Chinese or Spanish. You will find several variations with names alike, but the descriptions are self-explanatory and can help you differentiate them.
Simplified Chinese uses KBDUS.dll, that means "keyboard layout for US keyboard". This will apply to MS Pinyin, too. Change this value to your copied DLL name, so that it will load your DLL next time the OS launches.
Restart.
The result:
I can type English and Chinese pinyin with Microsoft Pinyin with my custom keyboard layout, and I can navigate next/previous page with , and ..
With this keyboard layout I can type Spanish special characters, like ï, á, ç, ñ and € without switching to Spanish keyboard.
Hotkeys in any software are working as expected, because now VK code are matched with letters printed on the keys.

Displaying Japanese text in the Immediate Window of Excel VBA

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!
How can I debug Japanese values in an English version of Excel using the Immediate Window?
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
Windows Vista (English)
Excel 2010 (English)
by going into the "Regional and Language Options" section of the Windows Control Panel and setting the system locale to "Japanese (Japan)"
After my system rebooted I could see Japanese characters in the VBA Immediate Window:

Arabic characters don't show in excel VBA code

I can't write arabic strings in VBA code in excel, it shows as weird characters. Tried it on many machines with excel 2013 or 2010, on windows 8 or windows 7, with or without arabic proofing tools installed. Arabic language is already installed on all machines, system locale is arabic. There's no problem typing arabic characters on excel worksheets or even MS word but not in VBA code.
in VB Editor:
1- click Tools
2- select Options...
3- click Editor Format
4- change font to Courier New (Arabic)
5- click OK
now you can write in both English and Arabic
I hope this will solve your problem
In Windows XP:
> Control Panel
> Regional and Language Options
> Advanced Tab
> Select Arabic (depending on your country) You will be asked to insert the Windows CD, insert it and then browse to the I386 Folder then press ok.
> restart the PC and it should work now fine.
I beleve it's the same on Windows 7, the whole problem is in the non-unicode programs section set it to Arabic.
In win 10, you must change your system locale to match your language. You can find it here:
1- Press win key or click on it
2- Type region and click on it when windows finds it
3- Choose administrative tab
4- Under the language for non-unicode programs you will find "change system locale" key
5- A restart would be required

How do I change the code page MS Visual Studio 2008 uses to open files?

I have a cpp file that uses ibm cp437 and Visual C++ keeps reading it with windows-1252. How do I make Visual C++ use the right code page for the file?
Alright, I figured it out myself. For the curious, here is the answer:
Right click the file in the Solution Explorer.
Select "Open With..."
Choose "C++ Source Code Editor (with encoding)"
A new box appears to specify Encoding. Choose "OEM United States - Codepage 437"
Done.
I also encountered these errors in my environments. I think there's any easier way to change the default code pages.
In windows 10, you could go to "Settings" -> "Region" -> "Administrative" tab -> "Language for non-Unicode programs". Then you could choose the region you want.
In this way, all the codes read from Visual Studio would use the code page whatever you want.
For example, the default setting for me is Chinese (Traditional, Taiwan). The code page is 950. But the codes are using windows-1252, therefore, I change the region to English (United States).
That's it.
Hope the solution could help you.
Thanks.
Unless you need the CP437 encoding, why don't you convert it to CP1252, UTF-8 or MS 'Unicode' (UCS-2)? Any reasonably capable editor should be able to do it.
VS2008 can do it - check out the Advanced Save option on the File menu.
Edit:
If you go to Source Control Explorer, right-click on the file, select 'Properties', you can set the encoding on the 'General' tab page. 'IBM437' is one of the choices.

Resources