How To Delete Extra Worksheet In Excel Using JavaScript/ActiveX

I am trying to delete 2nd excel sheet with the following

var objExcel = new ActiveXObject("Excel.Application");
var objWorkbook = objExcel.WorkBooks.Add;
var objWorkSheet = objWorkbook.WorkSheets(1);
objWorkSheet.Paste //Working fine
objWorkbook.WorkSheets(2)->Select;
objWorkbook.WorkSheets(2)->Delete;

I can successfully paste to the first worksheet, But I get a Syntax error for the last 2 lines from javascript. What am I missing?

Answers


Select() and Delete() are methods and need the brackets after their names.


Need Your Help

Only use one column of 2D array java

java arrays 2d

I have a 2D String array freq:

How to search cvs comment history

cvs

I am aware of this command: