Excel hangs while trying to open a workbook in ASP

L

Lize

Hi,

I'm writing an ASP application to open an excel workbook, then run a
macro stored in the excel file, which produces outputs that will be
displayed back onto my ASP application.

Now the problem I'm having is whenever I try to open a workbook (of
any format, i.e. 97/2000, 95, or xp, and of any size, and with or
without macros), excel just hangs forever, and if I killed the excel
application in task manager, my asp application will resume to run the
rest of the code.

I've given the internet guest user full rights along the entire path
for the excel file (the path for the excel file is
C:\Inetpub\wwwroot\test\test.xls).

My computer configurations are: WinXP Pro with Service Pack 1, Excel
2000, and IIS 5.1

One interesting thing to note is if I put a macro in my excel file
under Workbook_Open, doing only Application.Quit, excel doesn't hang
(i.e. my asp application runs to completion), which means that excel
probably opened my excel file, but it's either waiting for a prompt or
just stuck inside the excel application itself. I have made the excel
application visible and display alert, yet, I don't see any messages
popping up from excel.

Here is the code I'm using to open excel in my asp pages:

set ExcelApp = Server.CreateObject("Excel.Application")
'despite these 2 lines, I still don't see any messages
ExcelApp.Visible = true
ExcelApp.DisplayAlerts = true
ExcelApp.Workbooks.Open(Server.MapPath(filename)) --- it hangs here
'I've tried hardcoding the path, but still doesn't solve the problem,
also if
'I put in some false path (i.e. non existent excel file), it doesn't
hang
'I suppose this is expected because there's nothing to open, so excel
doesn't
'hang
ExcelApp.calculate
ExcelApp.save
'this is my macro in excel
graphHtml = ExcelApp.run(filename + "!produce_output", design_type,
test_type)
'to kill the application
ExcelApp.Quit
set ExcelApp = nothing

One last thing I should mention is, prior to this chunk of code, I
used an ADO connection to connect to the same excel file to do some
data updating (the reason for this is I find using ADO is faster and
more convenient, and partly because excel wasn't opening properly with
the excel object model), but I close it and set it to nothing before I
move onto this section of the program, don't know if it's affecting
anything though.

Thanks
Susan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,050
Latest member
AngelS122

Latest Threads

Top