title: vba read all text in a text file?
body: <p>I am trying to use vba to read all text in a text file and display it in an excel message box. the problem I have is whilst this is in effect working, it displays each line of text in a separate message box when instead I want it all in one?</p>
  
  <p>can someone please show me where I am going wrong. thanks</p>
  
  <pre><code>If Range("L" &amp; ActiveCell.Row).Value = "Performance" Then
  Dim FilePath As String
  Dim strLine As String
  FilePath = "\\UKSH000-FILE06\Purchasing\New_Supplier_Set_Ups_&amp;_Audits\ATTACHMENTS\" &amp; Range("C" &amp; ActiveCell.Row).Value &amp; "\performance.txt"
  Open FilePath For Input As #1
  While EOF(1) = False
      'read the next line of data in the text file
      Line Input #1, strLine
      'print the data in the current row
      MsgBox strLine
      'increment the row counter
      i = i + 1
  Wend
  Close #1
  
  End If
  </code></pre>