Write in Excel - Printable Version +- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums) +-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP) +--- Forum: UFT / QTP Others (https://www.learnqtp.com/forums/Forum-UFT-QTP-Others) +--- Thread: Write in Excel (/Thread-Write-in-Excel) |
Write in Excel - Anu - 05-24-2010 Hi, I have a query regarding writing data in Excel. I was able to write the data in excel but when i navigate to other web page then it over writes the previous data. Please tell me the way so that i can write the data in excel without overwriting the previous data. Hope it explains my problem........... Regards, Anu RE: Write in Excel - Saket - 05-24-2010 Hi Anu, would you like to elaborate the query, exactly what you need to write into excel and paste your code whatever you have tried so far. It will help us to understand better. RE: Write in Excel - basanth27 - 05-24-2010 Two ways to handle this, 1. Either use newer rows while navigating to the next webpage 2. Use a different sheet. Whichever should suit your need... RE: Write in Excel - Anu - 05-25-2010 Hi Saket, Below is the code.......................... Code: Dim xlSheet,xlBook, xlApp,a,CustomerName,Address,datatable Here i have parameterized the Link(“2″) that is in the object repository. When i run the script then it automatically goes to the next link and write data to excel sheet by overwritting the previous data. My problem is that-”I want data should not overwrite instead it should get append same as happen if we write data in txt” Hope this explains my problem………………… Regards, Anu ------------------------------------------------------------------------ RE: Write in Excel - Saket - 05-25-2010 You should use usedrange to append the data in your xls 1. identify the used range in the sheet 2. start adding value from the very next row. it woult be like below Code: nRow = xlSheet.UsedRange btw, what exactly you do with the this statement Code: iNewcolumn=xlSheet.UsedRange.Columns.Count + 1 do you execute this everytime a new link clicked? RE: Write in Excel - Anu - 05-25-2010 Hi, Some one has told me to use "iNewcolumn=xlSheet.UsedRange.Columns.Count + 1" this for adding the data in the new cloumn of same excel but it does not work from my side. Thanks For urs prompt reply................ Regards, Anu Hi Saket, I have tried the same code given by you.......... It is not adding the value to the next row. The code given by you is below: Code: nRow = xlSheet.UsedRange Waiting for response......... Regards, Anu Hi Saket, Your question : Do you execute this everytime a new link clicked? Answer: Please elaborate it......... Regards, Anu RE: Write in Excel - Saket - 05-25-2010 I am so sorry, surprised how I missed this , here is the corrected code Code: nRow = xlSheet.UsedRange.Rows.Count RE: Write in Excel - Anu - 05-25-2010 Hi Saket, Thnks Regards, Anu Hi Saket, This code is working but at the same time it is showing the error which is attached herewith. Please tell me how to handle this error Regards, Anu RE: Write in Excel - Anu - 05-25-2010 Hi Saket, Could you please look into this query on urgent basis. Hope you understand. Thanks in advance Regards, Anu RE: Write in Excel - Saket - 05-25-2010 check if your xls is checked read only. make it read/write, you will be able to use it. |