Access开发培训
网站公告
·Access专家课堂QQ群号:151711184    ·Access快速开发平台下载地址及教程    ·欢迎加入Access专家课堂微信群!    ·如何快速搜索本站文章|示例|资料    
您的位置: 首页 > 技术文章 > Access数据库-表

格式化读取文本文件

时 间:2007-10-29 09:02:42
作 者:harsonliao   ID:11  城市:上海  QQ:3002789054点击这里给麥田发消息
摘 要:格式化读取文本文件
正 文:

转载自OFFICE中国 harsonliao
Function ReadtxtFile(strPathName As String) As String
On Error GoTo Exit_Err
Dim strFile As String

Open strPathName For Input As #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
Loop
Close #1


Exit Function
Exit_Err:
MsgBox Err.Description
Exit Function
End Function


调用方法:
Private Sub 命令4_Click()
Me.txt1 = ReadtxtFile("c:\file1.txt")
End Sub


Access软件网官方交流QQ群 (群号:483923997)       Access源码网店

常见问答:

技术分类:

相关资源:

专栏作家

关于我们 | 服务条款 | 在线投稿 | 友情链接 | 网站统计 | 网站帮助