Hi Everyone,
We're trying to port our old VBA code to c# 2005 and are running into a problem when trying to retrieve a Com addin from word. In VBA we have :
Private _myIManExtObj As iManO2K.iManageExtensibility
Set _myIManExtObj = myWordApp.COMAddIns("iManO2K.AddinForWord2000").Object
Converting to c# i've got :
private static iManageExtensibility _iManExtObj;
object iManO2KComAddInRef = "iManO2K.AddinForWord2000";
_iManExtObj = (iManageExtensibility)_myWordApp.COMAddIns.Item(ref iManO2KComAddInRef).Object;
When I run this, I get :
A first chance exception of type 'System.Runtime.InteropServices.COMException' occurred in TemplateRationalisationProject.exe
'TemplateRationalisationProject.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System.Configuration\2.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Error creating document from template: System.Runtime.InteropServices.COMException (0x80040155): Interface not registered (Exception from HRESULT: 0x80040155)
at Microsoft.Office.Interop.Word.ApplicationClass.get_COMAddIns()
at TemplateRationalisationProject.Dms.Interwoven.IwApplication.InitaliseWordApp() in C:\Documents and Settings\waat\My Documents\Visual Studio 2005\Projects\TemplateRationalisationProject\TemplateRationalisationProject\Dms\Interwoven\IwApplication.cs:line 73
at TemplateRationalisationProject.Dms.Interwoven.IwApplication.GetInstance() in C:\Documents and Settings\waat\My Documents\Visual Studio 2005\Projects\TemplateRationalisationProject\TemplateRationalisationProject\Dms\Interwoven\IwApplication.cs:line 63
at TemplateRationalisationProject.Client.WordControl.Global.WordHelper.CreateNewDocument() in C:\Documents and Settings\waat\My Documents\Visual Studio 2005\Projects\TemplateRationalisationProject\TemplateRationalisationProject\Client\WordControl\Global\WordHelper.cs:line 348
The thread 0xd24 has exited with code 0 (0x0).
The thread 0xa94 has exited with code 0 (0x0).
The program '[3528] TemplateRationalisationProject.vshost.exe: Managed' has exited with code 0 (0x0).
I've then tried to enumerate throught he ComAddin collection :
IEnumerator myEnumerator;
myEnumerator = _myWordApp.COMAddIns.GetEnumerator();
while (myEnumerator.MoveNext())
{
// Print details here
}
This also fails on the second line (_myWordApp.COMAddIns.GetEnumerator()

Has anyone had this problem before?
Toast