ActiveX - Save Excel Workbook to Network

Hi Chaps,

I have an ActiveX Javascript function, that pulls data from an HTML table and then populates an Excel Workbook.

This works OK, but I need to save the workbook to a network path.

I have sucessfully saved it locally:


// Save the Excel Workbook
xlBook.SaveAs("C:\\\\TEST.XLSX");

But this does not:


// Save the Excel Workbook
xlBook.SaveAs("\\\\\\Server\\\\Projects\\\\TEST.XLSX");

When attempting this, I get this error:

SaveAs method of Workbook class failed

Which refers to the above.

I have tried different variations, but with little sucess (sometimes the path will default to the Server’s ‘My Documents’/‘User Shared’ folder, with the filename:

ServerProjectsTEST.XLSX

Anyone know where I’m going wrong?

Why are you building this on the client? Javascript will not let you save or delete a file on the users local hard drive.

However from the server side you can build the file and then push it as a download. If you are building the information on the client, then put it in some hidden field and post it to the server. All you have to do is set up proper headers and then write the content to the client. I believe it is echo in php.

I googled ‘php creating excel file’ and came up with tons of examples. The following link has information that may be of help to you.
http://www.appservnetwork.com/modules.php?name=News&file=article&sid=8

Is this from client to server? In this case you’ll need to upload it. PHP is working without any problem because it is executing on the server.

Uhh, I have tried to map the path to a drive letter with no luck . . .

Write access shouldn’t be a problem, with PHP I can create/edit/remove directories and files, so don’t see a problem with that.

The ActiveX feature can save the file to the server:

sometimes the path will default to the Server’s ‘My Documents’/‘User Shared’ folder

Just not in the place I told it to:
I say:

\\\Server\\Projects\\TEST.XLSX

It does:

\\\Server\\User Shared\\ServerProjectsTEST.XLSX

Mental?!

technically yes, this is an internal application, specifically for company employees. do you think i’d need to save a local copy first, then copy/upload the file to the server location? i can then delete the local copy so the user is none-the-wiser?

Shot in the dark here, but perhaps you have to map the server to a drive letter?

Are you sure you don’t need login credentials to access that server?

Do you have write access?

It could also be some ActiveX feature that only allows it to interact with the local computer.

Again, I’m just guessing possibilities here. Maybe they’ll help.