View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
Martin Brown Martin Brown is offline
external usenet poster
 
Posts: 230
Default Japanese in Macros

TKS_Mark wrote:
On the Japanese computer, the code for 集 is char(15672). But on the English
computer, char(15672) returns #VALUE!. And when I use the function
=code("集") on the English computer, it returns the answer 63. But when I
write =char(63) (or chr(63) in a macro) on the English computer, it returns
the question mark character "?".

Any ideas? It seems the chr results are different depending on the
computer's language.


I am afraid you are in out of your depth here. The Japanese language is
represented in a PC by double byte character sets so your best bet would
be to install a Japanese font on your PC and have a Japanese keyboard so
that you can see the right keycodes for data entry. Your message has
been encoded as UTF-8 which means the Japanese looks OK to me, but your
Anglicised 8bit version has lost a out in the conversion. You have to
work in a double byte character representation for Japanese. Unicode or
their native legacy DBCS representation.

"PA" wrote:

the chr() function is the same as the character function in Excel (not sure
of the name, I have french Excel). To get help on it, type chr in the VBA
editor and press F1.

Basicly, what it does is to return a character based on a number (0-255). So

Chr(74) & Chr(97) & Chr(112) & Chr(97) & Chr(110)

will return "Japan"

Explore a bit on it. Maybe you can return character from a different set of
letters (Japan).

Give me some news.

PA

"TKS_Mark" wrote:

What is the chr() function? Unfortunately, my programming experience it
limited to recording macros and trying to modify them slightly. If you give
me a hint, I can probably experiment and figure it out.

"PA" wrote:

Can you build your string in japan using the chr() function? Obviously, I
didn't try it on my computer;)

PA

"TKS_Mark" wrote:

I'm sharing an Excel 2007 file with coworkers in Japan. I use the indirect
function to build a formula based on several cells. The problem is, these
don't work on Japanese computers, so the formula results in #REF!

I was able to record a macro on a Japanese computer to translate from
English to Japanese:

Cells.Replace What:="[#Totals]", Replacement:="[#WŒv]", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False

The WŒv looks like [#集計] on the Japanese computer. When I run the above


I suspect you have that backwards. #集計 on the Japanese computer looks
like WŒv on yours. The Unicode representations are along the lines of
# 集 計
23,00 c6,96, 08,8A

But after whatever transformation MS inflicts upon it your #WŒv is
encoded with an entirely different byte sequence.
# W Πv
23,00 8F,00 57,00 52,01 76,00

(there is a gap at least in the font I am using so 8F,00 has no visible
representation on an English PC)

There is a chance that a string encoded on a Western PC with
=Char(198)&Char(150)&Char(8)&Char(138)
or possibly with the odd even bytes swapped might be rendered correctly
on a Japanese PC. failing that try
=char(15672/256)+Char(MOD(15672,256))
(or byte swapped)

program, nothing happens. There are no warnings, etc. When I paste from the
Japanese macro into the Excel file, it also looks like WŒv.

How can I get the Japanese to be properly recognized?


Are you asking here how to install Japanese fonts on a Western PC or how
to input data that will look right in both a Japanese and Western
environment. The simplest way to do it is to have a page of the business
keywords with English in column A and Japanese translations in column B
(the latter will look crazy on a Western PC and some unfortunate
combinations may even be illegal strings). One extra level of
indirection should give you something that can work with English or
Japanese business keywords.

Good luck! You are going to need it.

Regards,
Martin Brown