CGI deployment Save xls file

Hi,

I wrote this code to save a .xlsx file on my web server which is Apache 2.4 running on Windows Server 2008 R2 :

//Delete file if it exists
Dim fileName as String = “C:\apache24\htdocs\MFG\Sheet” + Session.userLogin + “.xlsx”
f=GetFolderItem(fileName)
f.Delete()

excel.AlertBeforeOverwriting = False
excel.ActiveSheet.SaveAs(fileName)

To explain the code: FIrst, I delete the file if it exists and I save the xlsx file I have generated before.

If I run this code within a program compiled as a standalone, it works perfectly.

if I run this code within a program compile as a CGI, it fails with this message:
Unhandled OLEException
Message: Exception, (failed on “SaveAs”)

The folder can be accessed because the file is actually deleted if it exists.
What is strange is that it works in a standalone mode but not in CGI mode. The apache server is runninf under an administrator account permissions.

Thanks for help because I do not see where the problem is.

[quote=101727:@Claude St-Pierre]Unhandled OLEException
Message: Exception, (failed on “SaveAs”)

The folder can be accessed because the file is actually deleted if it exists.
What is strange is that it works in a standalone mode but not in CGI mode. The apache server is runninf under an administrator account permissions.[/quote]

Obviously the error is OLE, not file path. But the error seems to manifest itself upon OLE save.

If OLE otherwise works fine within the application in CGI mode, is it possible that the standalone is launched by you as administrator and the CGI by the system, so the process maybe seen as having different writing permissions ?

I use the same administrator account with both CGI/standalone mode.

Is it possible to make something with an OLEException?

If you need to write Excel files, I would recommend checking out our XL plugin:
http://www.monkeybreadsoftware.de/xojo/plugin-xls.shtml

I doubt that a web app can get permissions to use OLE and talk to other apps.