I had to export excel file to csv file through vba script. csv file must be utf-8 code and delimted is "|"
I use SetLocaleInfo to set list separate as "|", but it only effect "xlcsv" not effect "xlunicodetext".
Private Function SetLocalSetting(LC_CONST As Long, strSetting As String) As Boolean
SetLocaleInfo GetUserDefaultLCID(), LC_CONST, strSetting
End Function
SetLocalSetting LOCALE_SLIST, "|"
When to use "xlUnicodeText", code is UTF-8 ,but the list seperator still is "Tab"
.SaveAs filename:="C:\temp\1.csv", FileFormat:=xlUnicodeText, Local:=True
When to use "xlCSV", the list seperator still is "|" what I need, but codepage is ANSI.
.SaveAs filename:="C:\temp\1.csv", FileFormat:=xlcsv, Local:=True
How to export a csv file with "|" seperator and UTF-8 ?