Note that there are some explanatory texts on larger screens.

plurals
  1. POExcel 2011 (Mac) vba: text encoding fails when importing text files as QueryTables
    primarykey
    data
    text
    <p>I need to import text files to Excel sheets. The text files come both from Macs and PCs and contain characters from various languages. For Excel 2004 (PC) I have successfully used vba code like below for converting Mac-coded text to PC-coding:</p> <pre><code>Worksheets("A").Cells.Clear pth = Application.GetOpenFilename() With Worksheets("A").QueryTables.Add(Connection:="TEXT;" &amp; pth, _ Destination:=Worksheets("A").Range("A1")) .TextFilePlatform = 10000 .TextFileColumnDataTypes = Array(xlTextFormat) .Refresh End With Worksheets("A").QueryTables(1).Delete </code></pre> <p>I am trying to use similar code for Excel 2011 to convert the coding from PC to Mac, using</p> <pre><code>.TextFilePlatform = xlWindows '=2 </code></pre> <p>as suggested by running the macro recorder. Doing the importing manually works perfectly, changing the coding from PC to Mac, but the vba program run in Excel 2011 does not change the coding at all. The TextFilePlatform parameter can (in my version of Excel 2011; different language versions might possibly differ here) be set to 1, 2, or 3 (any other integer from -1000000 to 1000000 gives error 5), and the resulting text looks exactly the same for these three cases. Is there some other setting that overrules my attempt to convert the text coding? Any suggestion greatly appreciated! </p> <p>Edit: I have confirmed that the code with .TextFilePlatform = xlWindows properly translates windows coded text to mac coding for Excel 10 (2001) and for Excel 11 (2004), contrary to the case for Excel 2011 described above. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload