| 网站首页 | 新闻 | 新书 | 专家 | 技巧 | 源码作品 | 工具/资源 | 商城 | 风采 | 留言 | 论坛 | 网址 | 承接 | 
您现在的位置: Access/Office中国 >> 技巧 >> Access >> OFFICE集成系统 >> 文章正文 用户登录 新用户注册
格式化读取文本文件         
格式化读取文本文件
作者:harsonli… 文章来源:第十空间 点击数: 本日:{$DayHits} 更新时间:2003-12-20 23:03:54

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

文章录入:tmtony    责任编辑:tmtony 
  • 上一篇文章:

  • 下一篇文章:
  • 【字体: 】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
    专 题 栏 目
    最 新 热 门
    最 新 推 荐
    相 关 文 章
    如何用VB or VBA 读取ex
    如何用Excel读取,修改,
    获取EXCEL某列最大值,并
    Excel如何读取Access数据
    解决ACCESS XP 粘贴数字
    将窗体内容导出到Excel
    在Word 2002中显示并调整
    注意对文本到语音的使用
    读取及设定文件的属性
    加解密文本的函数
    网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)