View Single Post
  #2   Report Post  
Bob Phillips
 
Posts: n/a
Default

You can't name a workbook in this way, Excel assigns the name in a list
Book1, Book2, etc. You only assign the name when you save it.

But it shouldn't matter, the variable JSNewWorkbook points at the workbook.

--
HTH

Bob Phillips

"mohit" wrote in message
...
Hello,

Not able to set Name of the workbook


My Javascript code look like this
JSActiveXObj = new ActiveXObject("Excel.Application");
JSNewWorkbook = JSActiveXObj.Workbooks.Add();

This code is working fine.

but if i try to give a name to the workbook using this code
JSActiveXObj = new ActiveXObject("Excel.Application");
JSNewWorkbook = JSActiveXObj.Workbooks.Add("xyx");

Sometimes it works fine but most of the times it is giving error. :(

Any help will be highly appreciated.
--
thanks and regards,
mohit