When you build and run the Word interoperability sample that is provided with the Microsoft .NET Framework Software Development Kit (SDK), you may receive the following error message when you call the Find object (the Console.WriteLine(myFind.Text); code line):
An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in [YourAppName.exe]
Additional information: Exception from HRESULT: 0xC0000005.
Word reuses Globally Unique Identifiers (GUIDs) that Microsoft Excel 95 originally used. If the Excel 95 type library is registered after the Word type library, you will experience this problem.
If it is not feasible to use late binding to resolve the problem, you can also reregister the Word type library. To do this, follow these steps:
Find the appropriate type library for the version of Word that is installed on the system.
From the command line, use Regtlib.exe with the full path to the type library to reregister the library for COM.
NOTE: Although this method is initially easier, the application may fail later on, because the problem recurs if the Excel 95 type library is reregistered by another application or a service pack.
For additional information about this problem and its resolutions, click the article numbers below
to view the articles in the Microsoft Knowledge Base: