08-23-2010, 10:38 AM
Hi Saket,
Again i am facing problem in writting data to excel.The code is mentioned below :
Will be thankful for yours valueable respose...............
Regards,
Anu
Again i am facing problem in writting data to excel.The code is mentioned below :
Code:
Dim xlSheet,xlBook, xlApp,a,CustomerName,Address,datatable
Const ForAppending = 8
const TristateTrue=-1
file_location = "C:\Test.xlsx"
Set xlApp = CreateObject("Excel.Application")
Set xlBook = xlApp.WorkBooks.Open("C:\Test.xlsx")
Set xlSheet = xlBook.WorkSheets("Sheet1")
Set oLinks = Description.Create
oLinks("micclass").Value = "Link"
oLinks("html tag").Value = "A"
Set AllLinks = Browser("Browser").Page("Page").WebTable("DataTable").WebTable("Table").ChildObjects(oLinks)
nLinks =AllLinks.count
For i = 1 to nLinks
CountOfRows=Browser("Browser").Page("Page").WebTable("DataTable").RowCount-1
nRow = xlSheet.UsedRange.Rows.Count
For j = 1 To CountOfRows + 1
CustomerName=Browser("Browser").Page("Page").WebTable("DataTable").GetCellData(i,2)
Address=Browser("Browser").Page("Page").WebTable("DataTable").GetCellData(i,3)
nRow = nRow + 1
xlSheet.Rows(nRow).Columns(1).Value =CustomerName
xlSheet.Rows(nRow).Columns(2).Value =Address
Next
oLinks("text").Value = i
Browser("Browser").Page("Page").WebTable("DataTable").WebTable("Table").Link(oLinks).Click
Next
xlApp.DisplayAlerts = False
xlBook.Save
'xlBook.Close
xlApp.Quit
Set xlApp = Nothing
Set xlBook = Nothing
Set xlSheet = Nothing
Regards,
Anu