且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

保存用 VBA 编码的 UTF-8 文本文件

更新时间:2023-02-20 11:00:21

我在 web 上找到了答案:

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 disk

当然不像我预期的那样......

Certainly not as I expected...