Home » excel » excel vba – Printing to file with vbNewLine results in double NewLine

excel vba – Printing to file with vbNewLine results in double NewLine

Posted by: admin May 14, 2020 Leave a comment

Questions:

I have the following simple line to print a new line to a log file:

Print #fileNumber, vbNewLine

However, this results in 2 newlines instead of one. My code does not have any other vbNewLines or anything that would print newlines.

If I do not have this print line, then I print no newlines, so this means this line is printing 2 newlines.

Does anyone have any ideas why?

How to&Answers:

Just tested this, and Print always adds a linebreak.

So simply using Print #fileNumber, will result in 1 blank line.

The problem is that Print already prints on a new line, so when you add vbnewline you’re getting 2 lines.