Public Sub ReadTxt()
Const ForReading = 1, ForWriting = 2, ForAppending = 3
Dim FileObj
Dim TextObj
Dim TmpPath As String
TmpPath = "d:\test.txt"
Set FileObj = CreateObject("Scripting.FileSystemObject")
Set TextObj = FileObj.OpenTextFile(TmpPath, ForReading, True)
Do While Not TextObj.AtEndOfLine
strSQL = TextObj.ReadLine '读txt文件内容
Loop
TextObj.Close
End Sub
VBA 读取TXT文件
最新推荐文章于 2024-05-25 08:47:43 发布