none
Working in VBA with worksheets cells containing polish characters in the string RRS feed

  • General discussion

  • I'm working with Excel worksheets that contains strings with polish characters. I.e. In cell A1 i have such text: "AĄEĘLŁOÓZŻŹ"

    Now, when i write a simple macro to copy a contenft from one cell to another, it works just fine.

        With Worksheets(1) 
            .Range("B1") = .Range("A1") 
            If .Range("A1") = .Range("B1") Then MsgBox "Sukces" 
        End With

    But if i create a string variable myText and hardcode this text into this variable in VBA, the result of this comparizon is unfortunatelly false.

        myText = "AĄEĘLŁOÓZŻŹ" 
        With Worksheets(1) 
            If myText = .Range("A1") Then MsgBox "Sukces" 
        End With

    The strange thing is:

    1. in debug mode when i place my cursor over myText variable, it shows me its value but all polish characters are replaced with some rubish. But when i open Immediate window (Ctrl+G) and run ?myText, it shows the correct value with polish characters.

    2. inside VBA i can write polish caracters corretly directly from keyboard, but when i copy the cell content and paste it into VBA all polish characters are replaced with some rubish.

    I'm using Excel 2013 english version, installed on Win7 64bit english version. Default input language in Win is set to Polish (Programmers). In VBA Tools/Options the language is set to Courier New (Central Europe).

    Can you please help me to fix the issue? 
    • Edited by JasiuRP Sunday, March 19, 2017 7:06 PM
    Sunday, March 19, 2017 7:04 PM

All replies

  • Hi JasiuRP,

    I'm a Japanese and interested in language and font.

    Here's an image of VBE.  Please watch myText  = "****".
    Characters between double quotations are copied from a cell [A1] manually.



    I suppose we should not use string/characters which depends on language, it would be better to use Hex code, instead of characters. 

    Would you explain what do you want to do in your VBA?

    Regards,
    Ashidacchi


    • Edited by Ashidacchi Monday, March 20, 2017 12:12 PM
    Monday, March 20, 2017 12:08 PM
  • I have similar problem. OS is english Windows 7 and installed polish OFFICE 210. Unfortunately, I have konversion errores w VBA (MS Excel 2010) -polish letters aren't good interpreted in SQL and in automatization wich MS Access . What shall I do?

    In IE I choose codding Central European (Windows) and is Good.
    In VBA I choose the same coding Central European and is bad :(




    • Edited by Adaxis Thursday, November 21, 2019 11:14 AM
    Thursday, November 21, 2019 10:12 AM