From: Christian Treffler on 27 Feb 2010 04:23 Peter T schrieb: > As a workaround try this - > > txt = Replace(txt, Chr$(228), "ae") ' � That's easy enough. Thanks to you and all the others for your inputs. CU, Christian
From: Krzysztof on 3 Mar 2010 11:25
I confirm. Code changes itself between English and Japanese computers. You will not find that bug if you simply change language to Japanese. You have to have "true" Japanese Windows. It happens when "text code" is internally loaded and interpreted by VBE and it happens for non-ascii characters. just new feature. workaround for this is to build that string dynamically not to use non-ascii characters in code instead of ill = "´`@€²³°^<>\*./[]:;|=?,""" it should be ill = chrw(1234) + chrw(2345)+ chrw(3456) .... and so on. On 2/23/2010 9:30 AM, Christian Treffler wrote: > 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 |