Don't you think a carriage return should be at the end of each line?
Yes it should be, but ONLY at the end of the line!
an extract of my csv file is:
"CustomerContactId","CustomerID","ContactPersonFirstName","ContactPersonLastName","UserName","UserPassword"
CR LF
9,1364,"RUTH",,"rapunzels","ruth"
CR LF
3001,2099379,"Marnette","Loubser
CR
","marnette
CR
","marnette01"
CR LF
2133,2098654,"Karen","Rousseau ","salon rouss","69chickens"
CR LF
I have made the CR & LF bold.
Look at the line 3001,2099379......
There should not be a
CR after Loubser or marnette
In fact this record should be on one line, not 3
In line 2133,2098654.....
after the word "Rousseau " NotePad++ shows a series of spaces (there are about 14 of them)
I have following code
Code:
Function RemoveCR(strData As String) As String
'Last character cannot be a carriage return
Do Until right(strData, 1) <> vbCr
RemoveCR = Left(strData, Len(strData) - 1)
Loop
'Last character cannot be a space
Do Until right(strData, 1) <> " "
RemoveCR = Left(strData, Len(strData) - 1)
Loop
End Function
the code
Code:
Do Until right(strData, 1) <> " "
RemoveCR = Left(strData, Len(strData) - 1)
Loop
just runs in a continuous loop. The space is not removed!
These are just two examples that I have found in my csv file!
I need to modify my function to ensure that all characters in the field are a keyboard character (can be entered from the keyboard), and that the last character is not a space.
How should I do this?
Many thanks