I'm developping a simple VB.NET COM addin for office 2000, XP, 2003 on Windows 2000, XP, 2003. When Word is launched, the method OnStartupComplete (of my addin), tries to retrieve the Word application which is the host application and to place it in a variable wordApp, which type is: Word.Application.
where applicationObject is a reference to the host Application.VB Code:
Dim WithEvents WordApp As Word.Application Public Sub OnStartupComplete(ByRef custom As System.Array) implements Extensibility.IDTExtensibility2.OnStartupComplete (*) WordApp = applicationObject ' try2 WordApp = DirectCast(applicationObject, Word.Application) ' try3 WordApp = CType(applicationObject, Word.Application) end sub
But at this time: (*), an Exception is thrown: "Exception from HRESULT: 0x80040200", even with try2 and try3.
What is strange with this problem, is that it doesn't work on WinXP + OfficeXP, but on other OS and Office configurations, it properly works (eg: Win2000 + Office 2003)
I'd like to add that I developped this addin with office 2003 and its libraries of objects: Microsoft Word 11.0 Object Library. version: 8.3. the file is: MSWORD.OLB.
Thanks in advance for helping a young trainee.
