Cannot Create Activex Component

D

Duncan

Hi

Writing some code that accesses Outlook via the

CreateObject("Outlook.Application")

mechanism. It has suddenly stopped working and now says it cannot create the
activex component. I have uninstalled/reinstalled outlook to no avail.

Anyone with a fix for this?

Thanks
 
K

Ken Slovak - [MVP - Outlook]

Are you running any anti-virus or firewall software that has a script
stopper, like McAfee or Norton/Symantec? Those can stop CreateObject() from
working.

Do you get the same thing if you try creating a Word.Application or
Excel.Application object using CreateObject()?
 
D

Duncan

Hi

I am running McAfee but have tried it with it turned off with no success.
Also tried to create Excel and that works fine. The nearest I have got to a
diagnosis is a posting I found elsewhere saying it was to do with
permissions/authorities, namely that VS runs with elevated privileges
(Administrator) and Outlook doesn't, so they clash. The prove that this may
have some validity is that if I shut Outlook and use the CreateObject method,
then the code runs.

What is baffling is why it suddenly stopped working when it originally
worked and/or why it ever worked if permissions are at the root of it all.

Does this make any sense to you?

Duncan
 
K

Ken Slovak - [MVP - Outlook]

McAfee has a script stopper that can be configured, unlike Norton's. I don't
use it so I don't know the details of how to configure the script stopper to
trust certain software, but it is possible.

Is this managed code you are using (VB.NET) or VBA code or VB6 code?

If it worked before and not now it's likely not a permissions issue. And I
run code in and out of VS versions all the time with no problems.

Did you recently install any addins or other code that accesses Outlook? I
have seen some cases where badly written managed code can prevent other code
from successfully calling CreateObject() or New() on the Outlook.Application
object. In my experiences with that it never happens to any Outlook addins,
just with standalone code. And the code works if that addin or synch program
is stopped from running.
 
D

Duncan

it is managed code (vb.net) in vs2008 using vsto3 therefore. I did have a
problem with the MS SMS addin around the same time but it has been
uninstalled and re-installed and appears to be working fine since.

As you suggest it could be an addin, I suppose I could try disabling them
one by one until I find it all works?

Duncan
 
K

Ken Slovak - [MVP - Outlook]

You can certainly try that.

Since it's VSTO 3 code I don't think the bug when opening Outlook in
"headless" from the original VSTO 2005 SE runtime would apply.

You might also want to review the information on debugging managed code
addins at
http://blogs.msdn.com/vsod/archive/2008/04/22/Troubleshooting-com-add-in-load-failures.aspx.
If there's some sort of loading issue you can examine what's going on with
the addin loading using the Fusion logging mentioned in that article.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top