kkmoslephour
New Member
- Joined
- May 8, 2014
- Messages
- 27
Hi guys, I am a little stuck here. I am trying to read in a text file and parse it by line breaks however I cannot read the content of the parsed line breaks, it just shows up as 'Empty' when I watch them.
However when I parse by space " " using
I can sucessfully see the contents of each array in my console window. So i am wondering why I cannot parse by line breaks.
Code:
Option Explicit
Sub ParseText()
Dim myFile As String, text As String, textline As String, Lastrow As Integer, i As Integer, Dim data() As String
myFile = Application.GetOpenFilename("Text Files (*.txt), *.txt")
If myFile <> "False" Then
MsgBox "Opening " & myFile
Else
MsgBox "Invalid File Path!", vbCritical, vbNullString
Exit Sub
End If
Open myFile For Input As #1
Do While Not EOF(1)
Line Input #1, textline
data = Split(textline, vbCrLf)
text = text & textline
MsgBox textline
Loop
However when I parse by space " " using
Code:
[COLOR=#000000][FONT=Arial][B]data = Split(textline, " ")[/B][/FONT][/COLOR]
Last edited: