View Single Post
 
Old 09-14-2022, 10:17 PM
TheBigBoss TheBigBoss is offline Windows 7 32bit Office 2010 32bit
Advanced Beginner
 
Join Date: Dec 2016
Posts: 56
TheBigBoss is on a distinguished road
Default

Quote:
Originally Posted by Guessed View Post
Ahh, I see what your problem is. The Split command is not returning a two dimensional array. Have a look at how many 'lines' you have after running the split command.

If you split a string containing carriage returns but don't use those CRs as the split trigger then the result will include those CRs in the middle of the array item. This means that
++ 105<CR>0 ++ splits to become and item in the array which is 105<CR>0
Guessed, thanks for helping. Your input is very helpful... indeed, issue is clearly the line break character.

I generate the .txt file with PHP and I use PHP_EOL for line break, which adds \r, \n\, or both \r\n, depending of server (Windows or Linux) - I need to check this. Also, it seems that opening files in txt mode in Windows will also change CRLF into CR...

Well, I need to do more testing.
a) Use something else than PHP_EOL for line break (in PHP)
b) Clean the line in VBA before splitting, to remove any vbLf, vbCr, vbCrLf and/or vbNewLine.

Thanks a lot

I wish there was a way to avoid this, generating
Reply With Quote