Yes, I have written a custom function in QTP for editing the Data table row colors.
Below is the code for this using Excel COM api’s.
Set xlApp=Createobject("Excel.Application")
set xlWorkBook=xlApp.workbooks.add
set xlWorkSheet=xlWorkbook.worksheet.add
xlWorkSheet.Range("A1:B10").interior.colorindex = 34 'Change the color of the cells
xlWorkSheet.Range("A1:A10").value="text" 'Will set values of all 10 rows to "text"
xlWorkSheet.Cells(1,1).value="Text" 'Will set the value of first row and first col
rowsCount=xlWorkSheet.Evaluate("COUNTA(A:A)") 'Will count the # of rows which have non blank value in the column A
colsCount=xlWorkSheet.Evaluate("COUNTA(1:1)") 'Will count the # of non blank columns in 1st row
xlWorkbook.SaveAs "C:\Test.xls"
xlWorkBook.Close
Set xlWorkSheet=Nothing
Set xlWorkBook=Nothing
set xlApp=Nothing
Showing posts with label api. Show all posts
Showing posts with label api. Show all posts
Wednesday, December 19, 2007
Did you write any custom function in QTP?
Posted by
QTP FAQ's Jobs interview questions
at
9:37 AM
0
comments
Labels: api, change colors, com, custom functions, data table, edit code, Functional testing, functions, mercury QTP, QTP, row colors, testing tools, vbscript
Subscribe to:
Posts (Atom)