Results 1 to 14 of 14

Thread: Split Text File Into Multiple Text Files keeping the header row

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #12
    VBAX Mentor
    Joined
    Nov 2022
    Location
    The Great Land
    Posts
    452
    Location
    Yes, I understand and my code allows line 1 to be bypassed and is not used in the output as instructed in post 7. I am sure there is more than one way to accomplish 'bypassing' line 1.

    Header not located on line 2 is another issue altogether.

    Why would you expect or depend on user to know which line header is on? This just allows for human error and corrupted output. Will header always be same text? Arnel has right idea to pull header row. Here is my version - tested and works.
        'get the header
        Do While Not TSRead.AtEndOfStream
            strH = TSRead.readline & vbCrLf
            If Left(strH, 1) = "C" Then Exit Do
        Loop
    Last edited by June7; 09-25-2023 at 11:55 AM.
    How to attach file: Reading and Posting Messages (vbaexpress.com), click Go Advanced below post edit window. To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •