格式化读取文本文件,第1张

格式化读取文本文件,第2张

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

位律师回复
DABAN RP主题是一个优秀的主题,极致后台体验,无插件,集成会员系统
白度搜_经验知识百科全书 » 格式化读取文本文件

0条评论

发表评论

提供最优质的资源集合

立即查看 了解详情