Function ReadText(FileName As String) As String
    With CreateObject("ADODB.Stream")
        .Type = 2
        .Mode = 3
        .Open
        .LoadFromFile FileName
        .Charset = "UTF-8"  '根据需要也可以选择Unicode
        .Position = 2
        ReadText= .ReadText
        .Close
    End With
End Function
Function ReadText(FileName As String) As String
    Dim Fso As New FileSystemObject
    Dim Fil As TextStream
    Set Fil = Fso.OpenTextFile(FileName, ForReading, False, TristateTrue)
    ReadText= Fil.ReadAll
End Function

 

posted on 2023-10-07 16:41  sonycat  阅读(359)  评论(0)    收藏  举报