|
|
|
|
Handling file in QTP
|
|
03-05-2010, 06:21 AM
Post: #1
|
|||
|
|||
|
Handling file in QTP
Hi All, I know how to create a text file and how to write in them. Is there any way to update them? i mean not to overwrite the file but to add another lines? Please help. Thanks, Ajit |
|||
|
03-05-2010, 12:05 PM
Post: #2
|
|||
|
|||
|
RE: Handling file in QTP
Yes, Open your file in append mode instead of write mode.
Thanks, ~Saket Kumar [Linkedin][pdf Api for QTP] It's so hard when I have to, and so easy when I want to... |
|||
|
03-05-2010, 01:16 PM
Post: #3
|
|||
|
|||
RE: Handling file in QTP
(03-05-2010 12:05 PM)Saket Wrote: Yes, Open your file in append mode instead of write mode. Hi Saket, I am trying as you have said but getting the invalid call procedure or argument. My code is: Dim fso, tf Set fso = CreateObject("Scripting.FileSystemObject") If (fso.FileExists ("c:\testfile.txt")) = True Then Set tf = fso.OpenTextFile("c:\testfile.txt", ForAppending, True) Else Set tf = fso.CreateTextFile("c:\testfile.txt", True) End If ' Write a line with a newline character. ' tf.WriteLine("CashOnHand TotalPortfolioWorth ShareHoldingValue") ' Write a line. tf.Write (CashOnHand&" "&TotalPortfolioWorth&" "&ShareHoldingValue) tf.Close Please correct me where i am wrong. Thanks; Ajit |
|||
|
03-05-2010, 02:14 PM
Post: #4
|
|||
|
|||
|
RE: Handling file in QTP
you have not defined 'ForAppending' anywhere in the code
add 'ForAppending = 8' this line at top. or use below statement - Set tf = fso.OpenTextFile("c:\testfile.txt", 8, True) Thanks, ~Saket Kumar [Linkedin][pdf Api for QTP] It's so hard when I have to, and so easy when I want to... |
|||
|
03-08-2010, 05:32 AM
Post: #5
|
|||
|
|||
RE: Handling file in QTP
(03-05-2010 02:14 PM)Saket Wrote: you have not defined 'ForAppending' anywhere in the code Great Saket. It worked. but what was the reason of not running of the old line? Thanks, Ajit |
|||
|
03-08-2010, 09:50 AM
Post: #6
|
|||
|
|||
|
RE: Handling file in QTP
refer the link for more details on this
http://msdn.microsoft.com/en-us/library/...S.85).aspx Thanks, ~Saket Kumar [Linkedin][pdf Api for QTP] It's so hard when I have to, and so easy when I want to... |
|||
|
« Next Oldest | Next Newest »
|
| Possibly Related Threads... | |||||
| Thread: | Author | Replies: | Views: | Last Post | |
| Handling Flash components through QTP...? | venkat_1241 | 1 | 1,530 |
06-23-2010 10:55 AM Last Post: Saket |
|
| Difference between error handling and exception handling | venkatbatchu | 5 | 3,139 |
11-11-2009 01:49 PM Last Post: sreekanth chilam |
|
User(s) browsing this thread: 1 Guest(s)
|
|

Search
Member List
Calendar
Help



