views:

109

answers:

2

Hello everyone,

I am using the following code to create Excel object using VBA. I am using Office 2003. I run the following code in classic ASP.

Set myexcel = CreateObject("Excel.Application")

Error message is, any permission needed to create Excel object?

Computer - default permission settings do not permit the address LocalHost (using LRPC) using the CLSID {00024500-0000-0000-C000-000000000046}

EDIT1:

I have a related question here, appreciate if anyone could take a look,

http://stackoverflow.com/questions/1383366/generating-excel-file-error

thanks in advance, George

+2  A: 

This article may be of interest, it says:

Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment.

You may wish to look at mime types and http://stackoverflow.com/questions/440892/how-to-output-an-excel-xls-file-from-classic-asp

Very, very roughly:

<%
Response.ContentType = "application/vnd.ms-excel"
%>
<TABLE>
<TR>
<TD>
<!-- Cell : A1 -->
2
</TD>
</TR>
<TR>
<TD>
<!-- Cell : A2 -->
3
</TD>
</TR>
<TR>
<TD>
<!-- Cell : A3 -->
=SUM(A1:A2)
</TD>
</TR>
</TABLE>
Remou
Thanks, but what is the solution to my issue? I have to use Excep in ASP.
George2
I really need to access Excel object to generate Excel file for download, any ideas?
George2
I have added a few notes. You will find more on this subject on StackOverflow and elsewhere.
Remou
Thanks Remou, I have looked through your recommended documents and they are really good. Since I am maintaining a legacy application and just install it on a new computer. I think your solution is optimum, but dues to limited time and resources, what I want to solve is why there is such error information, and how to properly change security settings to make it work. Any ideas why there is such security error messages?
George2
Here is a related question, appreciate if you could take a look. :-)
George2
A: 

If you want to get it to work, as opposed to implementing a more elegant solution.

==================== Workaround:

Its a security vunerability (but you said you must just get it to work)... however, have you tried adding the IUSR and IWAM accounts to the local activation and launch permissions for the COM+ application in question?

steps:

  1. open Dcomcnfg.exe

  2. open Component Services > My computer > DCOM Config

  3. Search for {00024500-0000-0000-C000-000000000046}

  4. right click properties > go to the Security tab

  5. under launch/activation permissions, click customise and edit

  6. make sure Admins, interactive, service and system are already added (local launch/act only)

  7. its classic ASP (on IIS 5 or 6 i assume) so try machine IUSR and IWAM accounts intially.

  8. If adding these doesn't work (local act and launch), if you have app pools try adding the account used for the application pool also (lookup the identity tab of the app pool).

  9. click ok/ok/ok.

  10. restart IIS/app pool.
Anonymous Type