in my excel file I had a few errors caused by people inputting commas or linefeeds into the data.
Perhaps your problem is caused by a multi-line string?
I solved mine by searching the string with 'instr' and replacing any 'hits' with a space...
-----------------
'xfer1 is the data read in from the .xls
Do
Point1 = InStr(xfer1, ",") 'strip out any commas
If Point1 > 0 Then
Mid(xfer1, Point1, 1) = " "
Else
Exit Do
End If
Loop
Do
Point1 = InStr(xfer1, Chr$(10)) 'strip out any LF's
If Point1 > 0 Then
Mid(xfer1, Point1, 1) = " "
Else
Exit Do
End If
Loop
-----------------------
If the problem is commas or LFs you could also try the intrinsic Replace function. It's possibly more likely that you need to look for vbNewLine characters rather than straight LFs
________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?' Drive a Steam Roller
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.