我正在excel中创建一个宏,用于处理电子表格并将内容(文本)写入文件。我需要将这个文件编码为UTF-8。我已经尝试使用OpenTextFile(... )以unicode格式打开该文件。TristateTrue)和StrConv(..vbUnicode),但它们只将其转换为UTF-16。我在网上找遍了,什么也找不到。这有可能吗?
谢谢
发布于 2015-02-23 12:22:17
Dim fsT As Object
Set fsT = CreateObject("ADODB.Stream")
fsT.Type = 2 'Specify stream type - we want To save text/string data.
fsT.Charset = "utf-8" 'Specify charset For the source text data.
fsT.Open 'Open the stream And write binary data To the object
fsT.WriteText "special characters: äöüß"
fsT.SaveToFile sFileName, 2 'Save binary data To diskhttps://stackoverflow.com/questions/11227632
复制相似问题