VBA and Displaying Chinese

F

FCC

Hello,

I am currently developing some VBA code for a chinese company. I would
like to display some chinese onto the Excel worksheets through VBA.

If I type chinese directly onto the excel worksheets I have no problem
displaying them, but when I try to display them through VBA code all I
get is ??

For example,

Range("A1") = "你好"

Would just make Cell A1 display as ??

Is there anyway I can make VBA display the chinese text properly?
 
F

FCC

How did the numbers 20320 and 22909 represented those characters? Is
there some kind of character list?
 
N

NickHK

You provided those character codes, so I don't know where you got them from.
However, you use the Character Map (which is AFAIK available on all systems)
to see the Hex codes for characters in various fonts/character sets.
You also have the VBA function ChrW and ASCW.
It depends somewhat on where your Chinese characters are coming from and
what you are doing with them.

NickHK
 
F

FCC

Opps, I actually typed by response incorrectly. I meant to say

How did you know the numbers 20320 and 22909 represented those
characters?

But in any case, I found the character Map on my operating system (XP
Home), but I am unable to display the hex let alone even search for the
characters I want.

I chose the character set Unicode and chose the font PMingLiU (which is
by default available as a font for all windows machines) and then I
tried to search for words and nothing happened.

Can you explain how you were able to find the hexcodes?

Thanks
 
N

NickHK

The Hex code is shown in the bottom left hand corner.
But if know the text you need to use, you can paste it into Excel, then
CharCode=AscW(Mid(Range("A1").Value,i,1), where i =1,2 or whatever.

But if have the text, can you not just it in Excel and forget about the VBA
side ?

NickHK
 
F

FCC

A late reply, but I am still not understanding what you are talking
about. I dont' see any hex code at the bottom left. This is an
example of what I see:

http://www.sfu.ca/~fcc/chinese.bmp

Is like U+4EDD supposed to be the hex code?

And what does CharCode=AscW(Mid(Range("A1").Value,i,1), where i =1,2 or
even mean? I can't find any good references to what AscW does.
 
F

FCC

All right. One last dumb-butt question from me:

How do we know that &H4EDD = 20189?

Forgive my ignorance :(
 
N

NickHK

CLng(&H4EDD)
=HEX2DEC(4EDD) 'If Analysis Tool Pack is installed
Or use Calculator to convert

NickHK
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top