SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 7 of 7
  1. #1
    Senior Member
    Join Date
    Sep 2004
    Location
    Ashland, ma, USA
    Posts
    275
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Row count in text file

    Is there a function which counts number of rows in
    text file?

    Thanks,
    Vitaly

  2. #2
    Moderator
    Join Date
    Sep 2001
    Location
    Doncaster, UK
    Posts
    5,788
    Post Thanks / Like
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Row count in text file

    Vitaly are you searching this forums before posting?

    We encourage people to search using the Advanced search facility at the top of the page.

    Forum members may not help if they think you haven't made an effort to find the answer before posting your question.

    Mark Smith.

  3. #3
    Senior Member
    Join Date
    Sep 2004
    Location
    Ashland, ma, USA
    Posts
    275
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Row count in text file

    I could not find an answer to my question using
    search.
    If you know it please tell me.
    Vitaly

  4. #4
    Moderator
    Join Date
    Jul 2005
    Location
    Delhi
    Posts
    15,575
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    7 Thread(s)
    Total Downloaded
    0

    Re: Row count in text file

    There would a code using FileSystemObject on the forum which will tell you how to read a file line by line and you can just put a counter variable to count the # of lines

  5. #5
    Senior Member
    Join Date
    Sep 2004
    Location
    Ashland, ma, USA
    Posts
    275
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Row count in text file

    It's not a problem to read file line by line.

    Without knowledge of the number of lines we
    cannot set an upper boundary of the loop.
    There may be a possibility to run a loop while
    the last line is not encountered. But I did not find
    this check.

    Vitaly

  6. #6
    Senior Member
    Join Date
    May 2004
    Location
    Lakeland, FL
    Posts
    299
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Row count in text file

    Dim scrFSO
    Dim scrTS
    Dim intLineCtr
    Dim strTmpLine

    Const forReading = 1

    intLineCtr = 0
    Set scrFSO = CreateObject("Scripting.FileSystemObject")
    If scrFSO.FileExists("C:\MyFile.txt") Then
    Set scrTS = scrFSO.OpenTextFile("C:\MyFile.txt", forReading, False)
    Do While Not scrTS.AtEndOfStream
    intLineCtr = intLineCtr + 1
    scrTS.ReadLine
    Loop
    End If
    MsgBox "There are " & intLineCtr & " lines in the file."
    JFry

  7. #7
    Senior Member
    Join Date
    Sep 2004
    Location
    Ashland, ma, USA
    Posts
    275
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Row count in text file

    Thank you, I found it too and tested it.
    It seems that it skips empty lines.

    Vitaly

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 11.54%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 11:20 AM.

Copyright BetaSoft Inc.