WordApplicationScope opens file in read-only

word
activities
p_solved

#1

Hi,
Iam opening an MS word file to automate some Style operations.
I use WordApplicationScope to open the document and perform all necessary activities within its scope.
Please note that the document is opened as Read-only by default when using WordApplicationScope.

The last step is to save the modified Word document as a pdf. I could accomplish this.
On automation completion, WordApplicationScope tries to close the document. As the document is Read-only, a “Save As” dialog pops up. The automation fails to finish due to this.
How can I get rid of this “Save As” dialog step?
Can the document be opened in a writable mode instead of the default Read-only mode?


#2

I was able to use a workaround to fix the issue.
After exporting the file as pdf, I closed the document using the keyboard shortcut Ctrl + f4.
This in turn pops up a Save confirmation dialog. I select the option “Dont save” which closes the document.

Iam marking this as the solution. If anyone else has a better solution, it is appreciated.