Add New Worksheet
Keywords: add worksheet workbook Excel
Question:
How do you add a worksheet once you open Excel and create one?Answer:
To add a new worksheet, you use the ADD method of the worksheets collection. Setup a reference to the worksheets collection then use .addFunction Add([Before], [After], [Count], [Type]) As Object Member of Excel.WorksheetsHere's how to add a blank workbook...:startExcel ; Start excel here excelxls = objectopen("Excel.Application") excelxls.visible = @false rptxls = excelxls.workbooks ; add a blank workbook... rptxls.add ; setup the sheets var... xsheets = excelxls.sheets objectclose(rptxls) return