Click here to Skip to main content
15,886,026 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
We have this simple piece Where in we are registering an Addin and trying to find the Addin by looping through the list of Addins. This is not consistently reproducible on all the machines and we started seeing this on a client machine. We dont see anything wrong with the code either. Please help.

When the code hits the for loop we get this error. Runtime Error -2147310770(8002801d). method 'comaddins' of object '_application' failed.

For Each oAddin In oWordApp.COMAddIns

Sub Main()

Call RegisterAddin

Dim oWordApp As New Word.Application

Dim oAddin As Office.COMAddIn

**For Each oAddin In oWordApp.COMAddIns**
    If oAddin.DESCRIPTION = "TestingCom Addin" Then
        oAddin.Connect = True
    End If
Next
Posted
Updated 23-Oct-14 6:30am
v2
Comments
PhilLenoir 23-Oct-14 14:04pm    
Have you checked to see if the registration failed. It could be that a dependency is missing from the setup for the component that is present on many of the machines (so registration works on some but not others). Try manually registering the DLL using regsrv32 on a machine where things are failing. You should get a more meaningful error message which may help you identify the problem (missing dependency etc.).
Guru16 23-Oct-14 14:46pm    
Thanks for the response. Please let me know which DLL I need to register. I'm just running a simple EXE.
Guru16 24-Oct-14 9:06am    
I can see the items under WordApp.ComAddins in the watch window but in the debug window it gives the error..

On the immediate window if I do this ?oWordApp.COMAddIns.Count I get 'Automation Error.. Library not registered'. Any idea which library is it referring to?

1 solution

I was able to fix this using the below link. Looks like the previous/latest version of Office was not uninstalled properly and was causing problems with Office 2007.

http://kb.palisade.com/index.php?pg=kb.page&id=528[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900