'This code demonstrate how to add new sheet to existing excel file and rename it at runtime
Dim oExcel, oWB, oSheet, getVal
Set oExcel=CreateObject("Excel.Application")
oExcel.visible=True
oExcel.DisplayAlerts = False 'this will not allow alerts to be displayed
Set oWB=oExcel.Workbooks.Open("C:\abhikansh.xls")
Set oSheet1=oWB.Sheets.Add 'a new sheet is added with default name i.e. Sheet4 etc.
oSheet1.Name="QTPSchools" 'rename newly added sheet
oSheet1.cells(1,1).value="Welcome" 'enter value
oWB.Save
oWB.Close
Set oExcel=Nothing
Dim oExcel, oWB, oSheet, getVal
Set oExcel=CreateObject("Excel.Application")
oExcel.visible=True
oExcel.DisplayAlerts = False 'this will not allow alerts to be displayed
Set oWB=oExcel.Workbooks.Open("C:\abhikansh.xls")
Set oSheet1=oWB.Sheets.Add 'a new sheet is added with default name i.e. Sheet4 etc.
oSheet1.Name="QTPSchools" 'rename newly added sheet
oSheet1.cells(1,1).value="Welcome" 'enter value
oWB.Save
oWB.Close
Set oExcel=Nothing
Its good, can u also explain the procedure for deleting a sheet... :)
ReplyDeleteoWB.worksheets(2).delete
ReplyDeleteHow to add 'n' number of sheets in excel using qtp
ReplyDeleteuse for loop for n number of sheets
ReplyDeletehi i want to save the runtime data table in to my local drive.. can u pls let me know the procedure
ReplyDeleteI аm really glad tto glane at this weblo poѕts which consiѕts of tonjs of useful information, thаnks for proѵiding tһeѕe dаta.
ReplyDeleteIf you need info on msnhotmailsignin