注册 登录
编程论坛 VB6论坛

如何用VB编一个能从文本文档中提取其中数据的程序?新手请教

zxqz1990 发布于 2013-03-04 16:06, 365 次点击
如题
1 回复
#2
曾大虾2013-03-05 18:30
请说具体点,要举个例子,请看下面要得不?
Public Function Txt(FName As String) As String
    Dim i As Integer
    Dim a, b

Open App.Path & "\" & FName For Binary As #1
    a = StrConv(InputB(LOF(1), 1), vbUnicode)
Close #1
Txt = a

End Function
   
Public Function TxtLine(FName As String) As String
    Dim tmp As String
    Open App.Path & "\" & FName For Input As #1
        Do While Not EOF(1)
            Line Input #1, tmp
            TxtLine = TxtLine & tmp & ","
        Loop
        TxtLine = Mid(TxtLine, 1, Len(TxtLine) - 1)
     Close #1
End Function
1