08-24-2010, 12:15 PM
Hi Anu,
I understood ur query.
Datatable is a Excel kind of thing which is similar like Excel.
If you want to write the data directly to excel then u need to use Excel objects.
It seems your way of thinking is completely writing data into excel.
See for this you have two ways.
First Way:
1. First fetch the data from web table to data table
2. Now export the data from the data table to excel using Datatable.Export "file path"
Second Way:
1. Using Excel objects
2. You need to create objects for excel application, workbook,worksheet
Ex: please get some idea by using excel objects
If you still dont get idea, first try to go through Datatable concept from learnqtp tutorial.
Note: Did you execute the code which i posted early for fetching data from web table to datatable.
Please let me know for further clarification.
Regards,
Venkat.Batchu
I understood ur query.
Datatable is a Excel kind of thing which is similar like Excel.
If you want to write the data directly to excel then u need to use Excel objects.
It seems your way of thinking is completely writing data into excel.
See for this you have two ways.
First Way:
1. First fetch the data from web table to data table
2. Now export the data from the data table to excel using Datatable.Export "file path"
Second Way:
1. Using Excel objects
2. You need to create objects for excel application, workbook,worksheet
Ex: please get some idea by using excel objects
Code:
Set aa=CreateObject ("Excel.Application")
Set b=aa.Workbooks.Open("C:\.........\Test Results\TestResults.xls")
Set c=aa.Worksheets("Sheet1")
aa.DisplayAlerts=False
rc=c.UsedRange.Rows.count
rc=rc+1
c.Cells(rc,1).value=Testcase
c.Cells(rc,2).value=Functionality
c.Cells(rc,3).value=Description
c.Cells(rc,4).value=Result
b.Save
b.Close
Set aa=Nothing
If you still dont get idea, first try to go through Datatable concept from learnqtp tutorial.
Note: Did you execute the code which i posted early for fetching data from web table to datatable.
Please let me know for further clarification.
Regards,
Venkat.Batchu