I am not able to understand your code. However assuming you want to
add contents to an existing excel sheet,

You can use the "UsedRange" property to find the already used rows and
add one to it to go to the next available row.

For example

newStartingRow = $worksheet.UsedRange.Rows.Count + 1

Also, instead of using Range method, you can use "Cells" method, this
will be natural for programming. For example

row=col=1
$worksheet.Cells(row, col).Value = "Cell A1"
#1, 2 is B1  5, 1 is A5

hope this helps

Regards,
Karthik

On Feb 4, 10:54 pm, Prince3105 <[email protected]> wrote:
> Hi All,
>
> I am a newbie to watir. My scenario is to validate e-mail text field
> with various input data which taken from a external  excel sheet, then
> i have to write the results to the same excel sheet. In some cases i
> should use the same data for more than one pages, if the test gets
> failed i should write the results to the results column with page
> name, if the test gets failed in more than pages i have to append the
> pages name one by one in a single cell.
>
> below code i am using for single page it works good.
>
>     $excel_path = "e:\\Data\\Prince\\WatIR\\Test Cases\
> \iTrade_Masters_Test_Report.xls"
>     $excel = WIN32OLE.new("excel.application")
>     $excel['Visible'] = true;
>     $workbook = $excel.Workbooks.Open $excel_path
>     $worksheet = $workbook.WorkSheets(6)
>     $worksheet.Select
>
>     # in the middle i start the application and open the particular
> page
>
>     until i > 14
>       i = 1
>       j = 0
>
>       j = i+84
>       $ie.frame(:id,"wfFrame").text_field(:id,"txtEmail").set
> $worksheet.Range("e#{j}")['Value']
>       $wsh.AppActivate("iTrade - Microsoft Internet Explorer")
>       $wsh.SendKeys"{TAB}"
>
>       if $ie.frame(:id,"wfFrame").div
> (:id,"PageActionPane_ValidationSummary1").li(:text,"Invalid Email
> ID").exists?
>         $ie.frame(:id,"wfFrame").div
> (:id,"PageActionPane_ValidationSummary1").li(:text,"Invalid Email
> ID").flash
>         $worksheet.Range("j#{j}")['Value'] = "Fail"
>         else
>         $worksheet.Range("j#{j}")['Value'] = "Pass"
>       end
>
>       i+=1
>     end
>
> I should use the same code for more than 5 pages and write the result
> to the same cell in append mode. If i use the same code for second
> page it overwrite the existing result.
>
> so give me the solution to append the results in a excel sheet's cell
>
> Thanks,
>
> Prince3105

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to [email protected]
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~----------~----~----~----~------~----~------~--~---

Reply via email to