logo elektroda
logo elektroda
X
logo elektroda

[Solved] VBA Excel: Fix Polish Characters Problem in CMD/DIR while Searching Files in Subdirectories

Bramcha 5772 2
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 17133257
    Bramcha
    Level 2  
    I need VBA excel to quickly search for files meeting certain criteria in all subdirectories on a network drive. And so I found a cool, which is very fast-acting code. Unfortunately, there is a problem with Polish characters. For example, the output of this code is as below.
    C: \ Users \ Andrzej \ Desktop \ vba \ Dzieä31.xlsm
    The letter ń is changed, even though typing the dir command manually and copying it manually works fine - that is, Polish characters are being copied. Do you know any solution to this problem? So that it doesn't slow down your code significantly?

    Code: VBScript
    Log in, to see the code
  • ADVERTISEMENT
  • Helpful post
    #2 17134742
    Prot
    Level 38  
    IMHO the simplest solution to this "tail node" is to change the code so that the reading of the files is dumped to a temporary file, e.g. out.txt (with the native encoding for the console, of course - 852 :!: ), and then import to Excel from this text file :idea: with the correct source coding indication, e.g.

    Code: VBScript
    Log in, to see the code
  • #3 17134907
    Bramcha
    Level 2  
    Thank you very much for your help.

    Added after 1 [hours] 4 [minutes]:

    It works. I followed Prot's instructions, but instead of encoding 852 I used 1250 in both VBA and bat file. This bat file is responsible for dumping the results of the dir command to the txt file.
    Code: VBScript
    Log in, to see the code

    The bat file looks like this:
    Code: Text
    Log in, to see the code
ADVERTISEMENT