![]() |
VBA and Displaying Chinese
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? -- FCC ------------------------------------------------------------------------ FCC's Profile: http://www.excelforum.com/member.php...o&userid=35888 View this thread: http://www.excelforum.com/showthread...hreadid=556805 |
VBA and Displaying Chinese
Range("A1").Value = ChrW(20320) & ChrW(22909)
NickHK "FCC" wrote in message ... 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? -- FCC ------------------------------------------------------------------------ FCC's Profile: http://www.excelforum.com/member.php...o&userid=35888 View this thread: http://www.excelforum.com/showthread...hreadid=556805 |
VBA and Displaying Chinese
How did the numbers 20320 and 22909 represented those characters? Is there some kind of character list? -- FCC ------------------------------------------------------------------------ FCC's Profile: http://www.excelforum.com/member.php...o&userid=35888 View this thread: http://www.excelforum.com/showthread...hreadid=556805 |
VBA and Displaying Chinese
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 "FCC" wrote in message ... How did the numbers 20320 and 22909 represented those characters? Is there some kind of character list? -- FCC ------------------------------------------------------------------------ FCC's Profile: http://www.excelforum.com/member.php...o&userid=35888 View this thread: http://www.excelforum.com/showthread...hreadid=556805 |
VBA and Displaying Chinese
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 -- FCC ------------------------------------------------------------------------ FCC's Profile: http://www.excelforum.com/member.php...o&userid=35888 View this thread: http://www.excelforum.com/showthread...hreadid=556805 |
VBA and Displaying Chinese
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 "FCC" wrote in message ... 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 -- FCC ------------------------------------------------------------------------ FCC's Profile: http://www.excelforum.com/member.php...o&userid=35888 View this thread: http://www.excelforum.com/showthread...hreadid=556805 |
VBA and Displaying Chinese
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. -- FCC ------------------------------------------------------------------------ FCC's Profile: http://www.excelforum.com/member.php...o&userid=35888 View this thread: http://www.excelforum.com/showthread...hreadid=556805 |
VBA and Displaying Chinese
Yes,
&H4EDD = 20189. Range("A1").Value=20189 NickHK "FCC" wrote in message ... 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. -- FCC ------------------------------------------------------------------------ FCC's Profile: http://www.excelforum.com/member.php...o&userid=35888 View this thread: http://www.excelforum.com/showthread...hreadid=556805 |
VBA and Displaying Chinese
That should read
Yes, &H4EDD = 20189. Range("A1").Value=ChrW(20189) NickHK "NickHK" wrote in message ... Yes, &H4EDD = 20189. Range("A1").Value=20189 NickHK "FCC" wrote in message ... 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. -- FCC ------------------------------------------------------------------------ FCC's Profile: http://www.excelforum.com/member.php...o&userid=35888 View this thread: http://www.excelforum.com/showthread...hreadid=556805 |
VBA and Displaying Chinese
All right. One last dumb-butt question from me: How do we know that &H4EDD = 20189? Forgive my ignorance :( -- FCC ------------------------------------------------------------------------ FCC's Profile: http://www.excelforum.com/member.php...o&userid=35888 View this thread: http://www.excelforum.com/showthread...hreadid=556805 |
VBA and Displaying Chinese
CLng(&H4EDD)
=HEX2DEC(4EDD) 'If Analysis Tool Pack is installed Or use Calculator to convert NickHK "FCC" wrote in message ... All right. One last dumb-butt question from me: How do we know that &H4EDD = 20189? Forgive my ignorance :( -- FCC ------------------------------------------------------------------------ FCC's Profile: http://www.excelforum.com/member.php...o&userid=35888 View this thread: http://www.excelforum.com/showthread...hreadid=556805 |
All times are GMT +1. The time now is 07:41 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com