Chinese characters in Excel VBA

I'm working on a Window 7 English platform with English and Chinese language installed on Office.

The Chinese characters are displayed properly under Excel content. However, I cannot use the Chinese characters under Excel VBA. Here, any Chinese characters (high code) in the code won't be displayed.

Is there a way to allow Excel VBA to read other Asian characters ?

Tks

<<question wording edited to improve readability--byundt, Microsoft Excel Topic Advisor>>
VBA-Chinese-chars.png
AXISHKAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

RartemassLife CoachCommented:
VBA uses Unicode for displaying text. Certain Chinese characters were left out of Unicode because they were rarely used (such as for place names or form part of personal names). The characters you want to display may be one of those.
The system is showing some characters but not others which leads me to think the above may be the case.
What are the characters you are trying to display?
0
FaustulusCommented:
You need a Chinese version of Windows in order to have the VB editor display Chinese characters. You can create Chinese texts, however, by spelling them out in Unicode. that is tedious. i have a converter somewhere which takes a string of Chinese characters entered in an Excel worksheet and writes the Unicode (simplifed) characters in the adjacent column from where they can be copied into the VBE. If you are interested, I can post the tool after I get back home. (I'm on the road today and tomorrow.)
Seeing that you have to enter the Chinese strings into Excel anyway, the better way to work around the problem is to have the Code directly access the cells in the worksheet where you store the strings. For this purpose you can create a dedicated worksheet with the Visible property set to xlVeryHidden. In practise, you create a little procedure that returns the desired string based upon a row number. Your code then looks like MsgBox MsgString(1). You can add the English translation as a remark in the code or have it in column B of the very hidden worksheet.
Once I had all of this figured out I didn't miss Chinese characters in VBE any more. Instead, I toyed with having traditional characters in column B (simplified in column A and English in column C) so that I could choose which language or character set to display just by adding one more argument to the MsgString call.
0
AXISHKAuthor Commented:
Tks, I want to test the tool.

Actually, I have put the Chinese chars on Excel, extract it on the vb and then show it with msgbox. However, it can't display properly. Can you also upload a simple excel to show how it works.

In addition, I have grab the Excel Chinese tab name and can't display it properly in VBA. Will there be any solution for this ?

Tks
0
FaustulusCommented:
I attach the tool. At the bottom of the code sheet I have added the procedure 'MessageText' and the sub 'TestMsgBox' to test it.
On my laptop I don't get the Chinese characters displayed in MsgBoxes because I have English as default language. I believe, if you run Chinese as default language you will get the proper display. In fact, it may be worth a try to see if you can enter Chinese characters in VB if Chinese is your default (as compared to a true Chinese OS with English as second language where I know it is possible). I know for a fact that Chinese as default language in an English version of Windows handles Chinese characters in MsgBoxes differently than where English is default and Chinese is the second language on the same platform.
You may like to read up at this link where they have another converter. Perhaps they found something I don't know. I tried their suggestion to create a MsgBox prompt directly from ChrW() characters but didn't have any luck with that.
EXX-131002-Chinese-Encoder.xlsm
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.