I wish to write some text to a file and if the file exists then it should overwrite and if it does not exists then QTP should create a file and write to it.
I am using following code:
Set strFile = fso.OpenTextFile(gstrReportXSLPath, ForWriting)
This code is overwriting the existing file but not creating the new file.
Please give your views on this problem.
Thanks and Regards,
Look at help files also when using stuff
mk:@MSITStore:C:\Program%20Files\Mercury%20Interac tive\QuickTest%20Professional\help\VBScript56.chm: :/html/jsmthOpenTextFile.htm
Buy the NEW QTP Descriptive Programming Unplugged Book
** Download QTP Unplugged 2nd Edition eBook for FREE **
In the above solution, file will not be overwritten.
My requirement is it should create the file if not exists and should overwrite the file if exists.
FSO.FileExists to implement that logic
It is throwing error "Path not found" for following code:
Function file: D:\Automation\Keywords\FrameworkFunctions.qfl
Line (380): " Set strFile = fso.OpenTextFile(gstrReportXSLPath, forWriting, True )".
sorry. there was a small mistake...
the path was missing a "\" so the parent folder was not existing, so it was erroring out. now the problem is resolved.
thanks Tarun for the help.