George2
George2

Reputation: 45771

error to create Excel object in VBA

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,

generating Excel file error

thanks in advance, George

Upvotes: 1

Views: 995

Answers (2)

Anonymous Type
Anonymous Type

Reputation: 3061

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.

Upvotes: 0

Fionnuala
Fionnuala

Reputation: 91356

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 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>

Upvotes: 2

Related Questions