MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Creating Excel through Javascript


Posted by Harry on August 30, 2001 10:53 AM

Hi,
I'm creating an Excel application as follows within a web page: -

ExcelApp = new ActiveXObject("Excel.Application");
ExcelSheet = new ActiveXObject("Excel.Sheet");

If i then leave that webpage the Excel application closes. This is what I want.

However when I name my worksheet as follows: -

ExcelSheet.ActiveSheet.Name = "MySheet";

then when I leave the page Excel stays open. Does anyone know how I can name a Worksheet and still have Excel shut when I leave my page?

Thanks, Harry


Posted by Damon Ostrander on August 30, 2001 3:11 PM

Hi Harry,

Have you tried:

ExcelApp.Save
ExcelApp.Quit

Where the save is done because you presumably want the changes you have made not to be lost, and if you don't you have to turn DisplayAlerts to False so that you don't get a message upon quitting Excel asking if you want to save.

Cheers.

Damon