Answer by bubblehead712 · Jan 05, 2016 at 03:08 PM
HP has great document to reference this question Check out KM171403.
Here is write example:
' Write some data to a file. Dim fso, MyFile Set fso = CreateObject("Scripting.FileSystemObject") Set MyFile = fso.CreateTextFile("C:\testfile.txt", True) MyFile.WriteLine("This is a test") MyFile.WriteLine("This is another test") MyFile.Close
Here is the read example:
' Read the data from the file. Dim fso, MyFile Set fso = CreateObject("Scripting.FileSystemObject") Set MyFile = fso.OpenTextFile("C:\testfile.txt") MsgBox MyFile.ReadLine MsgBox MyFile.ReadLine MyFile.Close
Answer by Rich Text · Jan 05, 2016 at 04:12 PM
You can also use some advanced techniques when reading from text files, like looping to the end of the doc and splitting text up into arrays if you need to use sections of it for data driving a test:
Answer by Rich Text · Jan 05, 2016 at 04:16 PM
Also, keep in mind that the FileSystemObject allows you to create files of different extensions as long as they are text files. You can create .CSV, .RTF, etc. using the same object and just change the filename you are either writing to or reading from.
Dealing with character limit on a field 2 Answers