|
-
Sep 17th, 2003, 05:11 PM
#1
Fanatic Member
I'm not exactly sure if I'm clear on what your saying, but, if you've been viewing this file in excel you should try viewing it in notepad then you'll see where those commas followed by one entry at the end. Lines 3, 4, & 5 are like that. Because this is saved as a .csv file it defaults to excel, so therefore if you type one value in the last column all the columns before it will still get seperated by commas even though they have no values. (lines 3,4,&5 in your file, also lines 1 & 2.)
Also instead of getting each line by a while not eof loop you should maybe try loading each line into an array, like so:
VB Code:
Dim MyLine() As String
Open [I]filename[/I] for Input As #1
MyString = Split(Input(LOF(1), 1), vbCrLf)
Close #1
'Then you can access each line like so:
MyString(0) 'Line 1
MtString(1) 'Line 2 and so on....
'Or you could loop through them...
For i = 0 to Ubound(MyLine)
'Do something with the line here
'Like with another array
strTemp = MyLine(i)
MyNewLine = Split(strTemp, ",")
'Or what ever you need to do here
Next i
"I have not failed. I've just found 10,000 ways that won't work."
'Thomas Edison'
"If we knew what it was we were doing it wouldn't be called research, would it?"
'Albert Einstein'
VB6
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|