Micro Focus QTP (UFT) Forums
Export WebElement value to 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 Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Export WebElement value to Excel (/Thread-Export-WebElement-value-to-Excel)



Export WebElement value to Excel - sssidana - 07-13-2012

Hello everyone I am trying to export the innertext value of webelement value to the excel sheet.I was able to get it in the msgbox but not in excel.help...!!!


RE: Export WebElement value to Excel - ravi.gajul - 07-13-2012

Hi,
Please see the code below for your reference
Code:
strText=Browser(...).Page(...).getRoproperty(....)
'Create Excel app
Set objAppExcel=CreateObject("Excel.Application")
objAppExcel.visible=True
'Open the worksbook
objAppExcel.workbooks.open "D:\Test.xls"
'Set focus on the workbook
objAppExcel.Workbooks("Test.xls").Activate
'Create work sheet obj
Set objExcelSheet=objAppExcel.ActiveWorkbook.Worksheets(1)
'Write to work sheet
objExcelSheet.cells(1,1)=strText
'Save worksheet
objExcelSheet.saveAs "D:\Test.xls"
'Clear  obj reference
Set objExcelSheet=Nothing
'quit app
objAppExcel.quit
Set objAppExcel=Nothing

Regards,
Ravi


RE: Export WebElement value to Excel - sssidana - 07-13-2012

Thanks a lot,,it worked