展开全部
Private Sub Command1_Click()
Dim FileName As String, b() As Byte, S As String
Dim ADO_Stream As Object
FileName = App.Path & "\1.txt" '请修改为具体文件名
If Dir(FileName) = "" Then Exit Sub
ReDim b(FileLen(FileName))
Open FileName For Binary As #1
Get #1, , b
Close #1
S = StrConv(b, vbUnicode)
Set ADO_Stream = CreateObject("ADODB.Stream")
With ADO_Stream
.Type = 2
.Mode = 3
.Charset = "utf-8"
.open
.WriteText S
.SaveToFile FileName, 2
End With
Set ADO_Stream = Nothing
MsgBox "文件转换完毕!"
End Sub
Dim FileName As String, b() As Byte, S As String
Dim ADO_Stream As Object
FileName = App.Path & "\1.txt" '请修改为具体文件名
If Dir(FileName) = "" Then Exit Sub
ReDim b(FileLen(FileName))
Open FileName For Binary As #1
Get #1, , b
Close #1
S = StrConv(b, vbUnicode)
Set ADO_Stream = CreateObject("ADODB.Stream")
With ADO_Stream
.Type = 2
.Mode = 3
.Charset = "utf-8"
.open
.WriteText S
.SaveToFile FileName, 2
End With
Set ADO_Stream = Nothing
MsgBox "文件转换完毕!"
End Sub
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询