Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I need to extract a specific line from a text file and what that line to a new file.

Status
Not open for further replies.

Dhiru16

Programmer
Jan 15, 2021
2
0
0
IN
thread329-1148463

Hey can I know how to write the text to a new file. I'm a bit new to it,any help is greatly appreciated!

Thanks
Dhiru
 
try something like this
Code:
'file name
output_file = "output.txt"

'create File System object
set Fso = CreateObject("Scripting.FileSystemObject")

const ForReading = 1, ForWriting = 2, ForAppending = 8 
'open the output file for writing
set oOutFile = fso.OpenTextFile(output_file, ForWriting, True)

out_line = "Hello"
'write to the output file
outFile.WriteLine(out_line)

'close the output file
outFile.close
 
Thanks Mikron,

What i'm looking for is i got a excel sheet from that i have to extract the specific field something like this Date:09-10-2020 and have this moved into a different file.

 
To work with excel files I used to use the object Excel.Application:
Code:
objExcel = CreateObject("Excel.Application")
But I'm not sure if it still works with newer windows and excel versions
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top