View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default Excel 2003 VBA program kills itself in Japan

That doesn't sound good at all !
As a workaround try this -

txt = Replace(txt, Chr$(228), "ae") ' ä

for your other characters, in the Immediate window type

and hit enter

Or type in cells and return with =CODE(A1)

Regards,
Peter T


"Christian Treffler" wrote in message
...
Hi,

I wrote a VBA program for an Excel workbook. This program works just
fine on my PC (US English setup), but my japanese collegues have
problems. We observed that the VBA program changes on a japanese PC to
the extent that syntax errors occur.

This is how it happens:

My code looks like this:
------------------------------------
Function ReplIllegal(ByVal txt As String) As String
Dim ill As String

ill = "´`@?²³°^<\*./[]:;|=?,""" ' list of illegal characters
ReplIllegal = ""

txt = Replace(txt, "ä", "ae")
txt = Replace(txt, "ö", "oe")
txt = Replace(txt, "ü", "ue")
txt = Replace(txt, "Ä", "Ae")
<snip
-------------------------------------

If the workbook is opened on a japanese computer, the code looks like
this
('$' stands for various japanese characters):
------------------------------------
Function ReplIllegal(ByVal txt As String) As String
Dim ill As String

ill = "$`@$$$$^<$*./[]:;|=?,""" ' Japanese characters!
ReplIllegal = ""

txt = Replace(txt, ". , "ae") ' Syntax Error
txt = Replace(txt, ". , "oe") ' Syntax Error
txt = Replace(txt, ". , "ue") ' Syntax Error
txt = Replace(txt, "$", "Ae")
<snip
-------------------------------------

Very bad is the replacement of "ä" by ". where the closing quotation
mark gets lost. That leads to a syntax error.

Is there any chance to avoid this problem? The solution must be applied
to the workbook. A client side solution (e.g. installation of an add-on)
is not acceptable.

TIA,
Christian