0

I need to generate a text file from my workbook. The text file should be in Unicode to preserve exotic characters, and should also follow UTF-8 encoding.

Below is the code that I am using. however, the generated text file is always encoded in UCS-2 LE BOM.

ActiveWorkbook.WebOptions.Encoding = msoEncodingUTF8
ActiveWorkbook.SaveAs Filename:="C:\Users\User1\Desktop\testunicode.txt", _
    FileFormat:=xlUnicodeText, CreateBackup:=False
  • Possible duplicate of [Excel VBA - export to UTF-8](http://stackoverflow.com/questions/12352958/excel-vba-export-to-utf-8) – Alastair McCormack Feb 04 '16 at 22:33
  • It doesn't look like Excel supports options for `SaveAs` to write UTF-8. Would a converter from UTF-16 to UTF-8 w/ BOM suffice? It's trivial using Python, for example. – Mark Tolonen Feb 05 '16 at 12:06
  • Thats a shame! The thing is that my requirement is to generate directly in UTF-8 encoding, as conversion might result in character loss. Thank you Mark! – Abdullatif Balaa Feb 05 '16 at 12:51

0 Answers0