Forum Discussion

jeetendra_mitta's avatar
jeetendra_mitta
Occasional Contributor
11 years ago

Adding new sheet in excel workbook.

Can someone post the code to adding any excel sheet in excel workbooks like sheet2, shet3 etc.


  • Set Excel = Sys.OleObject("Excel.Application")

    set temp = Excel.Workbooks.Open("pathToYourWorkbook")

    call temp.sheets.add()

    temp.activesheet.name = "This is my new worksheet"

    call temp.save



  • Set Excel = Sys.OleObject("Excel.Application")

    set temp = Excel.Workbooks.Open("pathToYourWorkbook")

    call temp.sheets.add()

    temp.activesheet.name = "This is my new worksheet"

    call temp.save