Jump to content
Macro Express Forums

How to determine the number of lines (records) in a text file?

Recommended Posts

The easiest way I found was:

  1. Create the special character Carriage Return or Line feed. (Newline)
  2. Copy the text of the first variable to a second variable.
  3. Remove all instance of the CR or LF from the second string variable. 
  4. Subtract the number of characters of the second string variable from the original variable. The difference is the number of newlines.
  5. Add 1 to that value.

You may want to trim the original text first to ensure there is not a trailing newline set. 

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...