|
5#
楼主 |
发表于 2012-12-22 09:13:28
|
只看该作者
access新闻爱好者 发表于 2012-12-21 17:05
解决了,就把答案贴上来吧,供其他人学习学习。谢谢了!!
Private Sub Command1_Click()
Dim objFile, stmFile
Dim strText As String
Set objFile = CreateObject("Scripting.FileSystemObject")
Set stmFile = objFile.OpenTextFile("f:\temp.txt", 1, False) 'temp.txt 文本编码utf-8
strText = stmFile.ReadAll
stmFile.Close
MsgBox tran_ado(strText) '
End Sub
'需要引用Microsoft ActiveX Data Objects 2.5 以上控件
Function tran_ado(ByVal strA As String) As String
Dim Stm As New ADODB.Stream
Stm.Type = adTypeText
Stm.Mode = adModeUnknown
Stm.Open
Stm.Charset = "gb2312"
Stm.WriteText strA
Stm.Position = 0
Stm.Type = adTypeText
Stm.Charset = "utf-8"
tran_ado = Stm.ReadText()
Stm.Close
End Function
|
|