Read Text File

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cengkidik
    New Member
    • Aug 2007
    • 1

    #1

    Read Text File

    i created 5 file and have a problem to read that file
    this is my coding, thanks

    [CODE=vb]Public Function ReadTextFileCon tentUsingFSO(By Val sFileName As String) As String
    Dim fs As FileSystemObjec t
    Dim ts As TextStream
    Dim strText As String
    Dim fnum As String
    Dim Ssvr As String
    Set fs = New FileSystemObjec t
    'To Read
    If fs.FileExists(s FileName) Then
    Set ts = fs.OpenTextFile (sFileName)
    Do While Not ts.AtEndOfStrea m
    strText = strText & ts.ReadLine & vbCrLf
    Loop
    ts.Close
    End If
    fnum = strText
    Set ts = Nothing
    Set fs = Nothing
    Ssvr = fnum
    checkStatus (Ssvr)
    End Function[/CODE]
    Last edited by Killer42; Aug 8 '07, 10:07 AM. Reason: Added [CODE=vb] tag
  • hariharanmca
    Top Contributor
    • Dec 2006
    • 1977

    #2
    Originally posted by cengkidik
    i created 5 file and have a problem to read that file
    this is my coding, thanks
    ...

    you did not explain, what is your problem? and what are all error that you getting?
    Last edited by Killer42; Aug 8 '07, 10:07 AM. Reason: Reduced huge quote block

    Comment

    Working...