How to write a new line in a text file?

How to write a new line in a text file?

I do a search of an excel file and depending on the answer

I want to write to a text file for logging.

I’m trying the following way but it’s overwriting the line.
"Não existem notas para estes filtros: " + row(1).ToString + Environment.NewLine

Hello @Rodrigo_Buch

You can use Append line activity to achieve this.

1 Like

use environment.newline

sampletext+environment.newline+sampletext2
or

sampletext+vbnewline+sampletext2

"Não existem notas para estes filtros: " + row(1).ToString + VbCrLf

New lines in text files (and everywhere else) are usually a carriage return AND line feed. That’s what VbCrLf is.

Write Text File will overwrite your file so it doesn’t matter if you add Environment.NewLine/vbCrLf or not.

Use Append Line as @Rahul_Unnikrishnan suggested. (You don’t need to add Environment.NewLine. This activity will add it for you.)

image

@ptrobot

Thanks it worked, I was keeping the write text.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.