[thelist] [ASP] Excel COM object reference

Jacques Capesius jacques_capesius at cnt.com
Thu Nov 7 08:24:01 CST 2002


I have the following line of ASP code that creates an excel spreadsheet and
saves it to the harddrive.

Dim objSpreadsheet
Set objSpreadsheet = Server.CreateObject("OWC.Spreadsheet")
objSpreadsheet.Cells(1,1).Value = "hoser"
objSpreadsheet.ActiveSheet.Export("c:\inetpub\jacquesdev\hoser.xls")
Set objSpreadsheet = Nothing

The code runs just fine, but when I go to open up the spreadsheet, I get a
message along the lines of "this spreadsheet has been locked for editing by
'another user'" and I can only open a read-only file of this spreadsheet.
When I try to delete this spreadsheet, I get a sharing violation.
Furthermore, in the task manager, there is an excel.exe process open that
wasn't open before, and when I try to kill the process, I get an access
denied. I try to stop and start the WWW Publishing Service, thinking that
might free the file up, but still, it won't let me delete this pesky little
critter. The only way I have been able to get rid of the file is by
rebooting the machine.

I assume there's some excel COM object setting that changes the excel sheet
from 'locked for editing' to 'go ahead, delete it. see if I care', but try
as I may, I can't seem to find any information on it. So... I'm turning to
you wizards. :-)

Is there some way to programmatically change the porperties of the
spreadsheet I'm exporting to the drive so that I can delete it without
having to do a hard reboot on the system?

thanks!

-jacques :)



More information about the thelist mailing list