Excel hangs while trying to open a workbook in ASP

Discussion in 'ASP General' started by Lize, Jul 7, 2004.

  1. Lize

    Lize Guest

    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
    Lize, Jul 7, 2004
    #1
    1. Advertising

  2. Tom Kaminski [MVP], Jul 7, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?SmltIEhlYXZleQ==?=

    Excel _WorkBook vs. Excel.Workbook

    =?Utf-8?B?SmltIEhlYXZleQ==?=, Sep 29, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    3,608
    Steve C. Orr [MVP, MCSD]
    Sep 29, 2004
  2. Yelena Kaplun
    Replies:
    1
    Views:
    5,137
    Yelena Kaplun
    Jan 19, 2005
  3. Alla
    Replies:
    3
    Views:
    223
    Andrea D'Onofrio [MSFT]
    Jan 9, 2004
  4. Gonzosez

    Open excel to a specific workbook.

    Gonzosez, May 10, 2004, in forum: ASP General
    Replies:
    0
    Views:
    117
    Gonzosez
    May 10, 2004
  5. Yelena Kaplun
    Replies:
    0
    Views:
    131
    Yelena Kaplun
    Jan 14, 2005
Loading...

Share This Page