Saturday, 10 August 2013

How to Create a File in QTP

We first create a FSO object using CreateObject and then create a text file using CreateTextFile.
For Example: Suppose you want to create a file called “test.txt” located in C:
     Dim fso, file, file_location
     file_location = "C:\file_location"
     Set fso = CreateObject(“Scripting.FileSystemObject”)
     Set file = fso.CreateTextFile(file_location, True) // True--> file is to be overwritten if it already exists      
     else false  We would use the same example for the rest of this post.

No comments:

Post a Comment