Benjagroup

tirsdag den 25. marts 2008

Word 2007 New Document Event

To catch the NewDocument event that is fired when a new document is created in a Word 2007 use the following:

((Word.ApplicationEvents4_Event)this.Application).NewDocument +=new Microsoft.Office.Interop.Word.ApplicationEvents4_NewDocumentEventHandler(ThisAddIn_NewDocument);

The IntelliSense cannot automatically generate the code needed - but if you write
((Word.ApplicationEvents4_Event)this.Application).NewDocument +=
it works like a dream :)

Etiketter:

0 kommentarer:

Send en kommentar

Abonner på Kommentarer til indlægget [Atom]

<< Start