格式化读取文本文件 |
|
www.nanhushi.com 佚名 不详 |
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
|
|
|
文章录入:杜斌 责任编辑:杜斌 |
|
上一篇文章: 如何判断表中是否存在相同的重复一条记录? 下一篇文章: 删除表中的重复项 |
【字体:小 大】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口】 |
|
|