相关文章推荐
爱看书的卤蛋  ·  Flutter - ...·  1 年前    · 
老实的橙子  ·  python ...·  1 年前    · 

we use a custom built application. It's built in VB and uses Word to generate documents. It works in Word 2010 and Word 2013.

But we cannot upgrade to Word 2016 because it breaks the generation of documents.

We receive a "An unhandled exception has occurred in the application.". Clicking details gives a bunch of information but most detailed is : "system.runtime.interop.services.COMException (0x800A148A)".

How can we fix this ?

Kind regards,

You may want to embed the types of interop assemblies . This gives you independence from office version. To do so:

  • Add a reference to the desired office interop assembly, for example Microsoft.Office.Interop.Word.dll
  • Right click on the dll reference and choose properties
  • In property window, set Embed Interop Types to true
  • Set Copy to Output Directory to Always to make sure you distribute the assembly with our application
  • Rebuild and distribute the new build on the target machines.
  • For more information:

  • Implement Send Mail from WinForm using both Outlook 2010 and 2013 C# (My answer on a similar topic)
  • Painless Office Interop Using Visual C# article by Claudio Bernasconi.
  • Walkthrough: Embed types from managed assemblies in Visual Studio
  •