Home |
Search |
Today's Posts |
#1
![]() |
|||
|
|||
![]()
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 |
#2
![]() |
|||
|
|||
![]()
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 |
#3
![]() |
|||
|
|||
![]()
Thanks Bob for the message...
But in my scenario I am exporting some data from the application to the Excel sheet on a button click.As i want to ask user to save the file anywhere by opening file open dialog box. I dont want to hardcode the path. For this reason, I am not saving the file in my code. I am just closing the file and excel is automatically asking user about saving of the file. JSNewWorkbook.Close(1); // i m passing one so that it will not show the message asking if you want to save the changes or not But the problem is that i want to show the name of the file based on some numbers. Suppose we are exporting the details of the employee. I want to give the file name based on employee number. Is there any workaround? -- thanks and regards, mohit "Bob Phillips" wrote: 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
HOW DO I SUM TWO CELLS FROM ONE WORKBOOK TO ANOTHER WORKBOOK? | Excel Worksheet Functions | |||
Linking a cell to another workbook cell based on a variable name | Excel Discussion (Misc queries) | |||
Playing a macro from another workbook | Excel Discussion (Misc queries) | |||
Unprotect Workbook | Excel Discussion (Misc queries) | |||
Stubborn toolbars in Excel | Excel Discussion (Misc queries) |