In this video tutorial we are going to discuss, working with Excel in UFT using our “Excel Object Model“.
Topics discussed:-
Topics discussed:-
- Understanding Excel object model(Application, Workbooks, Worksheet,Cell)
- Creating the corresponding objects for accessing Excel objects
- Fetching single cell data from excel
- Fetching data from complete Excel
- Writing data into Excel Cell
- Changing the Font color of cell in Excel
- Changing the Background color of cell in Excel
![]() |
Understanding Excel in UFT |
Sample Code Snippets:-
'Creating the Excel Object
set objExcel = createobject("excel.application")
'Creating the Workbooks object
set objWB = objExcel.workbooks.open (Path of Excel)
'Creating the sheet object
set objsheet = objwb.worksheets(SheetName)
'Changing the backgound color all the populated cells in sheet
for i= 1 to objsheet.usedrange.rows.count
for j = 1 to objsheet.usedrange.columns.count
objsheet.cells(i,j).interior.color=vbred
next
next
'Saving the workbook after changes
objWb.save
'closing the workbook
objWB.close
'Quit the Excel and destroying the Excel object
objExcel.Quit
set objExcel=nothing
Incase below video is not loaded, Click Here
How to copy Data from Notepad and Paste into Excel
Code for Adding Hyperlinks in Excel
How to get column address from column Name in Excel
How to Randomize Excel data?
2 replies on “Working with Excel Object Model in UFT”
anyone help me to fetch the complete data from excel
Please try to implement the above example it would help in achieving your target.
Thanks