title: VBA How To Skip a line in with StreamReader
body: <p>In VBA, I have to compare the two versions of a text file and print the lines that do not match. However, if an additional (user-specified) line has been added to the more recent text file, this line must be ignored, and the comparison must continue with the next line in the more recent text file. The text files are quite large and I cannot use the ReadAll property.
  Up until now I have assumed that there are the same number of lines in each text file and the order remains the same, therefore I used only the first text file to loop through all the lines. </p>
  
  <pre><code>Dim JsonPrev, JsonCurr As String  'Names of the text files
  Dim strLinePrev , strLineCurr As String  'The file text
  Dim UserLineAdded As String
  
  LineAdded = MsgBox("Does the most recent JSON contain an additional input / output, which the first does not?", vbYesNo, "Alert!")
  
      If LineAdded &lt;&gt; vbNo Then
          UserLineAdded = InputBox("Please provide the line that was added" &amp; vbNewLine &amp; "E.g. INPUT AdjustToDate, or OUTPUT Surrender Charge Base")
          If UserLineAdded = vbNullString Then
              MsgBox ("Comparison cancelled.")
              Exit Sub
          End If
      End If
  
  JsonPrev = Range("JSONPrevious").Value  'First Text File name
  JsonCurr = Range("JSONCurrent").Value   'Second Text File name
  
  Set objFSO = CreateObject("Scripting.FileSystemObject")
  Set objFilePrev = objFSO.OpenTextFile(JsonPrev, 1)
  Set objFileCurr = objFSO.OpenTextFile(JsonCurr, 1)
  
  DiffCount = 0
  
  Do Until objFilePrev.AtEndOfStream
      strLinePrev = objFilePrev.ReadLine
      StrLineCurr = objFileCurr.ReadLine
  
      prevLineNumber = prevLineNumber + 1
      currLineNumber = currLineNumber + 1
      If prevLineNumber &gt; 0 Or currLineNumber &gt; 0 Then
          'Check whether a Line was added
          If InStr(1, UCase(StrLineCurr), UCase(UserLineAdded)) Then
              currLineNumber = currLineNumber + 1
              '*****Add code to update StrLineCurr to the next ReadLine*****
          End If
  
          If strLinePrev &lt;&gt; StrLineCurr Then
                  DiffCount = DiffCount + 1
                  'code to print both lines from different sources
              End If
          End If
      End If
  
  Loop
  
  objFilePrev.Close
  objFileCurr.Close
  </code></pre>
  
  <p>Any help would be appreciated!</p>