Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Oct 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Problem with Excel.Application

    Hello....

    I m using asp to access excel and copy a worksheet from one excel to another. When i m trying to use Set objExcel = CreateObject(Excel.Application) and create an instance and access the excel i m unable to... Do i require to register any dll?? I have excel 2003 in my system.
    can someone help me with this. I m badly in need of this.

    I m not able to access the excel even by the following simple operation
    why is the following code not working for me?
    Function ExcelOperation()
    Dim objexcel
    Set objExcel = createobject("Excel.application") <----------- This is where it's failing
    objexcel.Visible = True
    objexcel.Workbooks.add
    objexcel.Cells(1, 1).Value = "Testing"
    objexcel.ActiveWorkbook.SaveAs("D:\test.xls")
    objexcel.Quit
    End Function
    Thanks in advance

    --Deepu

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    Zwolle, The Netherlands
    Posts
    1,120
    Thanks
    2
    Thanked 31 Times in 31 Posts
    In my case, this had to do with users. The asp is run under a ssystem account IUSR_servername. The first time this user starts excel, Excel wants to have some information from the user. What you can do is:
    • create a user that will be used to run this page
    • logon once to the machine as that user
    • start excel and enter the initials and name etcetera, what excel wants to register
    • log off
    • rerun your code

    or let the page run under your account, but that might be somewhat a securityrisk perhaps
    I am the luckiest man in the world

  • #3
    Regular Coder
    Join Date
    May 2007
    Location
    UK
    Posts
    180
    Thanks
    0
    Thanked 18 Times in 18 Posts
    Using an Excel.Application object in an ASP page is not ideal for a number of reasons:
    • You need another Excel licence to run it on the server.
    • If your ASP fails to close the Excel.Application object, as a result of a crash, perhaps, then the object is left on the server wasting memory.
    • The Excel.Application object runs under the wrong threading model.
    You can use ADO with an appropriate connection string to read and write to the two Excel databases.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •