VBA-WorkingWithText

Reading text

reading line by line

Set fs = CreateObject("Scripting.FileSystemObject")

f_name = pnl_dir & "\" & curr_file
Set f = fs.GetFile(f_name)
Set ts = f.OpenAsTextStream(1, -2)

Do While ts.AtEndOfStream <> True

abc = ts.ReadLine + Chr$(13)
Loop

Writing text

Writting in UNIX format


strFile =*path* + "\" + "batch_run"
Open strFileFor Output As #1

output_str = "Line 1"
output_str_add = "Line 2"
output_str = output_str + Chr(10) + output_str_add

Print #1, output_str
Close #1
Page last modified on February 11, 2022, at 01:11 PM
Powered by PmWiki