.netmultithreadingms-wordoffice-pia

Multithreading with Word automation


I am working with MS Word 2007 in VB.NET using the PIAs.

Specifically I am doing some processing on multiple Word.Document objects in memory which are part of the same Word.Application object. Can I process each Word.Document in a separate thread or does Word automation require a single thread?

Thanks,

Jacob


Solution

  • The Interlocked Class of Multithreaded Programming with Visual Basic .NET lets you you safely increment, decrement, exchange, and compare values from any thread. See also Writing Code in Office Solutions and How to: Target Office Applications Through Primary Interop Assemblies.