Quote Originally Posted by dglienna
VB Code:
  1. Option Explicit
  2.  
  3. Private Sub Form_Load()
  4.   Dim ff As Integer
  5.   Dim strBuff As String
  6.   Dim str() as string
  7.   ff = FreeFile
  8.   Open "c:\text.txt" For Input As #ff
  9.     strBuff = Input(LOF(ff), ff)
  10.   Close #ff
  11.   str() = split(strbuff, vbcrlf)
  12.   msgbox "There are " & ubound(str) -1 & " sentences in the file"
  13. End Sub
Hello! Can this code be used to search a text file for a string? When I tried it it worked but not on the whole file. I suppose the file is too big to load in a string. Is there a way around this without going into complex hardcore coding? Sorry but quite limited VB skills