Quote:
Originally posted by CT
Private Sub command1_click()
Dim strtext As String
Dim iCounter As Integer
Dim arrtxt() As String
strtext = "Oops Not Working"
arrtxt = Split(strtxt, " ")
For iCounter = LBound(arrText) To UBound(arrText)
MsgBox arrText(iCounter)
Next
Loop
End Sub
** Above sample code work fine for me. However if i added few lines as shown below, the split result will not work! it will split the words according but to only display a single line.
private sub command1_click()
Dim strtext As String
Dim iCounter As Integer
Dim arrtxt() As String
mfile = "c:\my documents\test.txt"
x = FreeFile
Open mfile For Input As #x
Do Until EOF(x)
Line Input #x, strtext
arrText = Split(strtext, " ")
For iCounter = LBound(arrText) To UBound(arrText)
msgbox(arrtext(icounter)
next iCounter ' Try that it might help
loop
end sub
** Above code is unable to find the " " inside every line i try to read. iCounter indicated a zero and the whole line was displayed rather than every word delimited by spaces.
Regards
Look in the code for my idea