Wednesday, 16 September 2015

HOW CAN I REPLACE TEXT IN AN EXCEL SPREADSHEET IN QTP?



Steps:

Create an object for excel application
Assign the visible property as true
Assign the excel file to the variable by using workbooks & open function
Focus on particular sheet by using workbook object
With the help of replace method we can replace  the text

Ans:
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
Set objWorkbook = objExcel.Workbooks.Open("C:\Scripts\Test.xls")
Set objWorksheet = objWorkbook.Worksheets(1)
Set objRange = objWorksheet.UsedRange
objRange.Replace "C:\Test\Image.jpg", "C:\Backup\Image.jpg"


SUBSCRIBE YOUTUBE CHANNEL FOR LATEST VIDEOS
 https://www.youtube.com/channel/UC1EmncBu2maDiHNMNNqxw9g

No comments:

Post a Comment