Shared Add-in: Is there a event after the document loaded ?

  • Thread starter Patrick Huang @ USTC
  • Start date
P

Patrick Huang @ USTC

Hi:
I am developing a Word shared add-in using VS2005 C#, I want to popup a
dialog after the document loaded. I tried to write it in OnConnection() or
OnStartupComplete() of IDTExtensibility2 interface, the dialog just popup
after the Word application opened but before the document loaded. Is there a
method or interface event happend after the document loaded, like AutoOpen()
macro in VBA?

Thanks,
P.Huang
 
S

Scott McPhillips [MVP]

Patrick Huang @ USTC said:
Hi:
I am developing a Word shared add-in using VS2005 C#, I want to popup a
dialog after the document loaded. I tried to write it in OnConnection()
or
OnStartupComplete() of IDTExtensibility2 interface, the dialog just popup
after the Word application opened but before the document loaded. Is there
a
method or interface event happend after the document loaded, like
AutoOpen()
macro in VBA?

Thanks,
P.Huang

See ApplicationEvents2.DocumentOpen and/or
ApplicationEvents2.DocumentChange.

The DocumentChange event also fires when the user changes the active
document, but some logic to detect whether or not the active document is a
new one should be practical.
 
P

Patrick Huang @ USTC

Thanks for your advice, but I still not clear after reading the MSDN
reference, could you help me with a code sample about how and where to use
the ApplicationEvents2 interface ? Thank you.
 
P

Patrick Huang @ USTC

I think I have found the way, by using
Microsoft.Office.Interop.Word.ApplicationEvents2_DocumentOpenEventHandler
in OnConnection().
You advice is really a good clue.
Thanks all the same.
 

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