PRB: The Open Event Fires More Than One Time When You Open a Managed Code Extension for a Microsoft Office Word 2003 Document (823995)
The information in this article applies to:
- Microsoft Office Word 2003
- Microsoft Visual Studio Tools for the Microsoft Office System version 2003
SYMPTOMSWhen you open a managed code extension for a Microsoft Office Word 2003 document, the Open event fires more than one time. This behavior might give you the impression that Word has stopped responding.CAUSEThis problem occurs if all of the following conditions are met: :
- Your Microsoft Visual Basic project Option Strict setting is set to Off.
-and- - You use one of the following methods in the Open event handler of the document:
- RecentFile::Add
- Windows::CompareSideBySideWith
- XMLNamespace::AttachToDocument
-and- - You pass the ThisDocument variable as a parameter to one of the aforementioned methods.
When you call one of the aforementioned methods, the document reference is passed as a parameter. When the document reference is passed as a parameter to a method that is used in the Open event, the managed code extension calls Word to sink additional objects to its connection point list. This behavior causes the Open event to fire more than one time.
RESOLUTIONTo resolve this problem, cast the ThisDocument variable to an Object data type variable, and then pass the Object data type variable. If the Option Strict project setting is turned on, you must cast the document parameter to an Object data type to avoid a compilation error.REFERENCESFor more information, visit the following Microsoft Web site:
Modification Type: | Minor | Last Reviewed: | 2/3/2006 |
---|
Keywords: | kbprb kbPIA KB823995 kbAudDeveloper |
---|
|