Cannot Create ActiveX Component

  • Thread starter Thread starter Marisha
  • Start date Start date
M

Marisha

Hi guys,

I have some quiet common problem as I see from answers in the group.
I'm trying to create excel opject when running web application.
And it's filing on this step:
excel_app = CreateObject("Excel.Application")
I'm impersonating administrator and i tried dcomcnfg.exe to add
administrator to excel aplication security tab.
Any ideas,what's wrong?

Thanks,

Marina
 
Hi Marina,

What's the exception you get? It might be that the creation of COM objects
is not allowed for Web applications by the Framework itself.
 
Hi Dmytro,

Thanks for you reply,
I'm getting an error of :Cannot create ActiveX Component.
It's looks like security problem,but as I said I'm impersonating
administrator in my code.

Thanks,

Marina
 
Are you sure "Excel.Application" is a correct ProgID?

More than that, what's the CreateObject function? Is it a VB .NET shortcut
for Type.GetTypeFromProgID(...) and Activator.CreateInstance(...)?
 
in order to call createobject on the excel application, the excel interop
must be correctly installed on the target system. make sure that is the case
before going further

--
Regards,
Alvin Bruney - ASP.NET MVP

[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
Now available @ www.lulu.com/owc, Amazon.com etc
Dmytro Lapshyn said:
Hi Marina,

What's the exception you get? It might be that the creation of COM objects
is not allowed for Web applications by the Framework itself.

--
Sincerely,
Dmytro Lapshyn [Visual Developer - Visual C# MVP]


Marisha said:
Hi guys,

I have some quiet common problem as I see from answers in the group.
I'm trying to create excel opject when running web application.
And it's filing on this step:
excel_app = CreateObject("Excel.Application")
I'm impersonating administrator and i tried dcomcnfg.exe to add
administrator to excel aplication security tab.
Any ideas,what's wrong?

Thanks,

Marina
 
Alvin,

I don't think so - the interop assembly is required if the Excel object is
created as a *TYPED* object, but Marina uses HttpServerUtility.CreateObject
that just returns an untyped System.Object reference.

--
Sincerely,
Dmytro Lapshyn [Visual Developer - Visual C# MVP]


Alvin Bruney said:
in order to call createobject on the excel application, the excel interop
must be correctly installed on the target system. make sure that is the
case before going further

--
Regards,
Alvin Bruney - ASP.NET MVP

[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
Now available @ www.lulu.com/owc, Amazon.com etc
Dmytro Lapshyn said:
Hi Marina,

What's the exception you get? It might be that the creation of COM
objects is not allowed for Web applications by the Framework itself.

--
Sincerely,
Dmytro Lapshyn [Visual Developer - Visual C# MVP]


Marisha said:
Hi guys,

I have some quiet common problem as I see from answers in the group.
I'm trying to create excel opject when running web application.
And it's filing on this step:
excel_app = CreateObject("Excel.Application")
I'm impersonating administrator and i tried dcomcnfg.exe to add
administrator to excel aplication security tab.
Any ideas,what's wrong?

Thanks,

Marina
 
Then how does it know what to create? It must know what an Excel.Application
is right? That knowledge comes only after an installation.

--
Regards,
Alvin Bruney - ASP.NET MVP

[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
Now available @ www.lulu.com/owc, Amazon.com etc
Dmytro Lapshyn said:
Alvin,

I don't think so - the interop assembly is required if the Excel object is
created as a *TYPED* object, but Marina uses
HttpServerUtility.CreateObject that just returns an untyped System.Object
reference.

--
Sincerely,
Dmytro Lapshyn [Visual Developer - Visual C# MVP]


Alvin Bruney said:
in order to call createobject on the excel application, the excel interop
must be correctly installed on the target system. make sure that is the
case before going further

--
Regards,
Alvin Bruney - ASP.NET MVP

[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
Now available @ www.lulu.com/owc, Amazon.com etc
Dmytro Lapshyn said:
Hi Marina,

What's the exception you get? It might be that the creation of COM
objects is not allowed for Web applications by the Framework itself.

--
Sincerely,
Dmytro Lapshyn [Visual Developer - Visual C# MVP]


Hi guys,

I have some quiet common problem as I see from answers in the group.
I'm trying to create excel opject when running web application.
And it's filing on this step:
excel_app = CreateObject("Excel.Application")
I'm impersonating administrator and i tried dcomcnfg.exe to add
administrator to excel aplication security tab.
Any ideas,what's wrong?

Thanks,

Marina
 
Right, but only after the installation of Excel itself, not its Interop
assembly. The latter does not register any ProgIDs in the registry, it
merely instructs the framework on proper creation of runtime-callable
wrappers.

--
Sincerely,
Dmytro Lapshyn [Visual Developer - Visual C# MVP]


Alvin Bruney said:
Then how does it know what to create? It must know what an
Excel.Application is right? That knowledge comes only after an
installation.

--
Regards,
Alvin Bruney - ASP.NET MVP

[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
Now available @ www.lulu.com/owc, Amazon.com etc
Dmytro Lapshyn said:
Alvin,

I don't think so - the interop assembly is required if the Excel object
is created as a *TYPED* object, but Marina uses
HttpServerUtility.CreateObject that just returns an untyped System.Object
reference.

--
Sincerely,
Dmytro Lapshyn [Visual Developer - Visual C# MVP]


Alvin Bruney said:
in order to call createobject on the excel application, the excel
interop must be correctly installed on the target system. make sure that
is the case before going further

--
Regards,
Alvin Bruney - ASP.NET MVP

[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
Now available @ www.lulu.com/owc, Amazon.com etc
message Hi Marina,

What's the exception you get? It might be that the creation of COM
objects is not allowed for Web applications by the Framework itself.

--
Sincerely,
Dmytro Lapshyn [Visual Developer - Visual C# MVP]


Hi guys,

I have some quiet common problem as I see from answers in the group.
I'm trying to create excel opject when running web application.
And it's filing on this step:
excel_app = CreateObject("Excel.Application")
I'm impersonating administrator and i tried dcomcnfg.exe to add
administrator to excel aplication security tab.
Any ideas,what's wrong?

Thanks,

Marina
 
I see what you are saying. That's correct. I change my advice to this:


--
Regards,
Alvin Bruney - ASP.NET MVP

[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
Now available @ www.lulu.com/owc, Amazon.com etc
Dmytro Lapshyn said:
Right, but only after the installation of Excel itself, not its Interop
assembly. The latter does not register any ProgIDs in the registry, it
merely instructs the framework on proper creation of runtime-callable
wrappers.

--
Sincerely,
Dmytro Lapshyn [Visual Developer - Visual C# MVP]


Alvin Bruney said:
Then how does it know what to create? It must know what an
Excel.Application is right? That knowledge comes only after an
installation.

--
Regards,
Alvin Bruney - ASP.NET MVP

[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
Now available @ www.lulu.com/owc, Amazon.com etc
Dmytro Lapshyn said:
Alvin,

I don't think so - the interop assembly is required if the Excel object
is created as a *TYPED* object, but Marina uses
HttpServerUtility.CreateObject that just returns an untyped
System.Object reference.

--
Sincerely,
Dmytro Lapshyn [Visual Developer - Visual C# MVP]


"Alvin Bruney [MVP - ASP.NET]" <www.lulu.com/owc> wrote in message
in order to call createobject on the excel application, the excel
interop must be correctly installed on the target system. make sure
that is the case before going further

--
Regards,
Alvin Bruney - ASP.NET MVP

[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
Now available @ www.lulu.com/owc, Amazon.com etc
message Hi Marina,

What's the exception you get? It might be that the creation of COM
objects is not allowed for Web applications by the Framework itself.

--
Sincerely,
Dmytro Lapshyn [Visual Developer - Visual C# MVP]


Hi guys,

I have some quiet common problem as I see from answers in the group.
I'm trying to create excel opject when running web application.
And it's filing on this step:
excel_app = CreateObject("Excel.Application")
I'm impersonating administrator and i tried dcomcnfg.exe to add
administrator to excel aplication security tab.
Any ideas,what's wrong?

Thanks,

Marina
 
Back
Top