...

View Full Version : Problem with Excel.Application



deepthi
10-26-2007, 06:44 AM
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

Roelf
10-26-2007, 08:56 AM
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

SouthwaterDave
10-27-2007, 11:42 AM
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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum