Wednesday, 16 September 2015

HOW CAN I ADD ADDITIONAL WORKSHEETS TO AN EXCEL WORKBOOK IN QTP



Steps:

Create an object for excel application

Assign the visible property as true
Adding a sheet by using workbooks.add method & assigning to variable
Assigning sheet to variable
Adding to the excelsheet
Ans:
This script adds the nine new worksheets directly after worksheet 1 (thus pushing sheets 2 and 3 to the end of the collection):

Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
Set objWorkbook = objExcel.Workbooks.Add()
Set objWorksheet = objWorkbook.Worksheets(1)
Set colSheets = objWorkbook.Sheets
colSheets.Add ,objWorksheet,9


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

No comments:

Post a Comment