c++ms-wordword-automationword-2003

Safe to perform Word automation on open document?


I'm looking to perform Microsoft Word automation -- straightforward stuff such as instructing Word to open a document and save it as an RTF file. But what happens if the user already has the document open in a running instance of Word? Can I still safely perform automation actions (that don't modify the document itself), or am I asking for trouble? Will this interfere with the user working on the open document? Are there any alternative ways to accomplish the same thing?

I'm only interested in Word 2003 and later (but also about the Word for the Mac, as this will eventually be a cross-platform application).


Solution

  • There are lot of problems in doing this.

    1. First of all Microsoft doesnt recommend to use Word for automation. use OpenXML instead. In my experience every day I ended up investigation Com exceptions by automating Word in Server. http://support.microsoft.com/kb/257757

    2. Even if you attempt to take the risk by automating, It is bad idea to use the machine where there is users interaction. If there is some dialog box opened like find or save as it will not allow another instance of Word to do any other functionality.

    3. If you dont find any other solution like me then create a new user profile called OfficeAutomationUser and follow the steps in http://theether.net/download/Microsoft/kb/288367.html

    Thanks for reading my Words of caution about automating. Note: I am not C++ programmer I use VSTO with C#