Fix some of your macros

1 Star2 Stars3 Stars4 Stars5 Stars (4 votes, average: 4.75 out of 5)
Loading...
Go back to All Questions Login or Register
426 views
0

Hello, I have tried all these macros from Analyst Cave:

Merge CSV files or TXT files in a folder – using Excel or CMD

The problem is that all merged files finished with empty lines inside

I have replaced this line:
result = result & IIf(addNewLine, vbNewLine, "") & IIf(firstHeader, textData, Right(textData, Len(textData) - InStr(textData, vbNewLine)))

With this line:
result = result & IIf(addNewLine, vbNewLine, "") & IIf(firstHeader, textData, Right(textData, Len(textData) - InStr(textData, vbNewLine)-1))

Doing it the problem is solved!

You should fix them too in your web…

Thanks!

0

Hi Rolo,

thanks for your input. Frankly however, I am not able to reproduce your error. The CSV files I tested merged perfectly without trailing new lines. Please if possible attach your csv files tested and the code you used. Thanks!

Simply the best place to learn VBA!