Sub coding()
Const codepageWin1251 = "windows-1251"
Const codepageDOS866 = "cp866"
Const codepageKOI8R = "koi8-r"
Const codepageUTF7 = "utf-7"
Const codepageUTF8 = "utf-8"
Const codepageASCII = "ascii"
Const adWriteChar = 0
Const adTypeText = 2
Const adSaveCreateOverWrite = 2
Dim pStream As Object, sTxt As String
Set pStream = CreateObject("ADODB.Stream")
pStream.Type = adTypeText
pStream.Charset = codepageWin1251
pStream.Open
pStream.LoadFromFile ActiveWorkbook.Path & "" & global_save_date & "\NAM.csv"
sTxt = pStream.ReadText
pStream.Close
pStream.Charset = codepageDOS866
pStream.Open
pStream.WriteText sTxt, adWriteChar
pStream.SaveToFile ActiveWorkbook.Path & "" & global_save_date & "\NAM.csv", adSaveCreateOverWrite
pStream.Close
End Sub
|