Word XP and .NET NewDocument event ambiguous error 
Author Message
 Word XP and .NET NewDocument event ambiguous error

I came accross the ambiguous interface problem in the past when I tried to
invoke Word XP from a Windows App:
http://www.*-*-*.com/ ;EN-US;Q315981
The Word.ApplicationClass workaround did the trick back then.

Now I'm building an Addin for Word XP and want it to catch the event when
the user opens a new document, opens an existing one or switching between
documents. So from Extensibility.IDTExtensibility2 I recieve an Application
object, that is in essence of type Word.Application.

The DocumentOpen and DocumentChange events work as expected, but trying to
implement the NewDocument event fails because of the ambiguous interface
problem. Trying to fit an Application object recieved from extensibility
into an ApplicationClass object fails.

I didn't find a KB on MS or any post about this problem anywhere on internet
or newsgroup. Maybe anyone here can help? (I crossposted it to
microsoft.public.office.developer.automation and
microsoft.public.dotnet.languages.vb)

Can someone tell how to catch that event with an Application object, or how
to turn an Application object into an ApplicationClass object that is also
able to raise events? The workaround should then be awarded a place on the
KB list ;-)

Thanks in advance,
Peter Aragon



Mon, 31 Jan 2005 15:03:24 GMT  
 Word XP and .NET NewDocument event ambiguous error
Hi

Another mystery is when I have a CommandBarComboBox and I want to catch the
OnChange event. It only works for the first instance of Word.
CommandBarButton objects behave correctly... Bug? Workaround?

Thanks,
Peter


Quote:
> I came accross the ambiguous interface problem in the past when I tried to
> invoke Word XP from a Windows App:
> http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q315981
> The Word.ApplicationClass workaround did the trick back then.

> Now I'm building an Addin for Word XP and want it to catch the event when
> the user opens a new document, opens an existing one or switching between
> documents. So from Extensibility.IDTExtensibility2 I recieve an
Application
> object, that is in essence of type Word.Application.

> The DocumentOpen and DocumentChange events work as expected, but trying to
> implement the NewDocument event fails because of the ambiguous interface
> problem. Trying to fit an Application object recieved from extensibility
> into an ApplicationClass object fails.

> I didn't find a KB on MS or any post about this problem anywhere on
internet
> or newsgroup. Maybe anyone here can help? (I crossposted it to
> microsoft.public.office.developer.automation and
> microsoft.public.dotnet.languages.vb)

> Can someone tell how to catch that event with an Application object, or
how
> to turn an Application object into an ApplicationClass object that is also
> able to raise events? The workaround should then be awarded a place on the
> KB list ;-)

> Thanks in advance,
> Peter Aragon



Mon, 31 Jan 2005 17:16:52 GMT  
 Word XP and .NET NewDocument event ambiguous error

Quote:
>The DocumentOpen and DocumentChange events work as expected, but trying to
>implement the NewDocument event fails because of the ambiguous interface
>problem. Trying to fit an Application object recieved from extensibility
>into an ApplicationClass object fails.

Fails how, exactly? Does YourApplicationObject.GetType().ToString()
return "System.__ComObject" or "Word.Application"?

Mattias

===
Mattias Sj?gren (VB MVP)

http://www.msjogren.net/dotnet/



Thu, 03 Feb 2005 05:52:06 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Quit method call to a Word object returns ambiguous Error in VB.Net

2. Passing a parameter to the NewDocument event

3. Word XP Template Error on Word 97

4. Word XP - Document_New Event

5. How to: Fax Merge for MS WORD XP , code in vb.NET

6. Insert text into Word XP using VB.Net?

7. Trouble starting Word from VB.NET when in XP

8. Word XP and Visual Basic. Net Problem

9. ASP.NET Custom control: Ambiguous match found?!

10. Getting Error Code:5922 when running word mail merge on Office XP

11. VBA error when closing Word XP (2002)

12. VBA error when closing Word XP (2002)

 

 
Powered by phpBB® Forum Software