格式化读取文本文件
harsonliao
Function ReadtxtFile(str path name As String)As String
On Error GoTo Exit _ Err
Dim strFile As String
将strPathName作为# 1
ReadtxtFile = " "
strFile = " "打开用于输入
do While Not EOF(1)
Line Input # 1,strFile ' = Input(1,# 1)
if ReadtxtFile = " " then
ReadtxtFile = strFile
else
ReadtxtFile = ReadtxtFile & vbCrLf & strFile
end if
循环
Close #1
Exit函数
Exit_Err:
MsgBox Err。描述
退出函数
结束函数
方法:
Private Sub command 4 _ click()
me . txt 1 = read txt file(" c:\ file 1 . txt ")
end Sub
0条评论