Working with Excel Object Model in UFT

In this video tutorial we are going to discuss, working with Excel in UFT using our “Excel Object Model“.

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

Excel object model in UFT
Understanding Excel in UFT

Sample Code Snippets:-

'Creating the Excel Object
set objExcel = createobject("excel.application")
'Creating the Workbooks object
set objWB = (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
'Saving the workbook after changes
'closing the workbook

'Quit the Excel and destroying the Excel object
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”

Leave a Reply

Your email address will not be published. Required fields are marked *