workbooks.open function fails to open an existing excel file when used in ASP, but works in VB.

Discussion in 'Microsoft Excel Programming' started by san, Jan 3, 2006.

  1. san

    san Guest

    Hi all,
    The following script (asp code) works like a charm on my workstation
    IIS


    Dim objExcel
    Dim objWorkBook
    Set objExcel = CreateObject("EXCEL.APPLICATION")
    Set objWorkBook = objExcel.Workbooks.Open("C:\test\test.xls")
    objWorkBook.SaveAs ("C:\test\test2.xls")
    objWorkBook.Close True
    Set objWorkBook = Nothing
    Set objExcel = Nothing


    The code above is just a sample, the actual app is ASP and involves DB
    access, reading/writing excel files, ...
    Trying to narrow the scope I found out that the simple script above
    does not work on the server, rather works fine on my workstation IIS.
    (Note: My workstation also has IIS)
    The test.xls file is the most simple XL file ever, and the path is OK
    The NT account I use definitely has write permissions on the target
    directory, and test2.xls does not exist when I run the script.

    Excel is installed on the server and works normally when used as a
    client app.
    But it seems to fail miserabily when used as an activeX object. The
    script above says it can't find the file, but both the directory and
    the fiel definitely exist on the server.

    Any ideas what could break / alter the way excel works when used as an
    activeX object from another App/Script ?

    Any comments welcome

    Santhosh
     
    san, Jan 3, 2006
    #1
    1. Advertisements

  2. Just reading the script there doesn't seem to be anything wrong with it,
    although you could make it objWorkbook.Close False (rather than true).

    However, excel is definitely not recommended as a server side application.

    I have had some success running the office web components as a server side
    component although even this is not fully supported by MS. For simple
    actions like the ones you are showing, the OWC may be a better route to go.
    There is a lack of documentation on OWC, but most things will work as they
    would in Excel, with a far smaller memory overhead and faster create/destroy
    times.

    Robin Hammond
    www.enhanceddatasystems.com

    "san" <> wrote in message
    news:...
    > Hi all,
    > The following script (asp code) works like a charm on my workstation
    > IIS
    >
    >
    > Dim objExcel
    > Dim objWorkBook
    > Set objExcel = CreateObject("EXCEL.APPLICATION")
    > Set objWorkBook = objExcel.Workbooks.Open("C:\test\test.xls")
    > objWorkBook.SaveAs ("C:\test\test2.xls")
    > objWorkBook.Close True
    > Set objWorkBook = Nothing
    > Set objExcel = Nothing
    >
    >
    > The code above is just a sample, the actual app is ASP and involves DB
    > access, reading/writing excel files, ...
    > Trying to narrow the scope I found out that the simple script above
    > does not work on the server, rather works fine on my workstation IIS.
    > (Note: My workstation also has IIS)
    > The test.xls file is the most simple XL file ever, and the path is OK
    > The NT account I use definitely has write permissions on the target
    > directory, and test2.xls does not exist when I run the script.
    >
    > Excel is installed on the server and works normally when used as a
    > client app.
    > But it seems to fail miserabily when used as an activeX object. The
    > script above says it can't find the file, but both the directory and
    > the fiel definitely exist on the server.
    >
    > Any ideas what could break / alter the way excel works when used as an
    > activeX object from another App/Script ?
    >
    > Any comments welcome
    >
    > Santhosh
    >
     
    Robin Hammond, Jan 3, 2006
    #2
    1. Advertisements

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. Frank Jones
    Replies:
    2
    Views:
    8,278
    Peter Huang
    Jun 15, 2004
  2. devi
    Replies:
    1
    Views:
    482
    keepITcool
    Jan 24, 2005
  3. RobinW

    Set buttons to own workbooks, but not to general workbooks.

    RobinW, Jul 8, 2005, in forum: Microsoft Excel Programming
    Replies:
    0
    Views:
    167
    RobinW
    Jul 8, 2005
  4. Guest

    Excel VBA works fine but not in two workbooks. Help

    Guest, May 17, 2007, in forum: Microsoft Excel Programming
    Replies:
    6
    Views:
    192
    JE McGimpsey
    May 17, 2007
  5. ker_01
    Replies:
    10
    Views:
    1,001
Loading...

Share This Page