注意哦 
1一定是txt格式的 也就是说能被记事本直接打开的
2一定是Unicode编码的
3不能引用非vb默认的库知道的大侠麻烦写一下吧

解决方案 »

  1.   

    我在这里提供一段函数,希望能够用的着。Function ConvertToUni(ByVal sHTML As String, ByVal sFilePathName As String, Optional isOverWrite As Boolean = True) As Integer
     'sHTML为要写入的字符,sFilePathName为要写入的文件名及所在路径,isOverWrite判断写入的文件名是否存在
     
     On Error GoTo Err
     Dim strLastError As String
     strLastError = ""
        Dim iOverwrite As Integer
        
        If isOverWrite = False Then
          iOverwrite = 1
        Else
          iOverwrite = 2
        End If
        Dim stm As Object
        Set stm = CreateObject("adodb.stream")
        stm.Type = 2 '以本模式读取
        stm.Mode = 3
        stm.Charset = "Unicode"
        stm.Open
        stm.WriteText sHTML
        'iOverwrit用来决断是否覆盖写入
        stm.SaveToFile sFilePathName, iOverwrite
            
        If Err <> 0 Then
          strLastError = Err & " " & Err.Description
        End If
        
        stm.Flush
        stm.Close
        Set stm = Nothing
        ConvertToUni = Err
        
        Exit Function
        
    Err:
        MsgBox Err.Description & " " & Err.Number
        stm.Flush
        stm.Close
        Set stm = Nothing
        ConvertToUni = Err
    End Function
      

  2.   

    谢谢 不过不准用adodb啊  它是非vb默认的库 
      

  3.   

    Sub WriteUnicodeFile(ByVal FileName As String, ByVal Text As String)
        Const BOM As Integer = &HFEFF
        Dim hFile As Integer
        Dim aBytes() As Byte
        
        aBytes = Text
        
        If LenB(Dir(FileName)) <> 0 Then
            Kill FileName
        End If
        
        hFile = FreeFile()
        Open FileName For Binary Access Write Lock Read Write As #hFile
        
        Put #hFile, , BOM
        Put #hFile, , aBytes
        
        Close #hFile
    End Sub