Word Application Scope - Export To PDF - Process freezes

Hi Experts

I have build a process that opens a Word document and converts it to PDF. It is all done by creating a Word Application Scope using the Export To PDF activity inside.

The job is scheduled to run automatically and in most cases everything works fine. However on some rare occasions the process freezes doing nothing. In the Event Viewer the following error is reported:

System.Runtime.InteropServices.COMException (0x800401E3): Operation unavailable (Exception from HRESULT: 0x800401E3 (MK_E_UNAVAILABLE))
at System.Runtime.InteropServices.Marshal.GetActiveObject(Guid& rclsid, IntPtr reserved, Object& ppunk)
at System.Runtime.InteropServices.Marshal.GetActiveObject(String progID)
at UiPath.Word.WordDocument…ctor(String documentPath, Boolean createNew)

I have noticed that Word is not closed properly after the PDF conversion. If I go into Task Manager there is a Word process running and if killing the process the job will continue.

Any ideas what is causing this?

@jacchr have similar issue, Bot get completely stuck while appending the text in word document. Any updates on it how you resolved it?

@sumit.tyagi I never found the actual root cause of the problem - but I suspect it to be related to the antivirus running on the machine.

However I solved it by writing a code snippet in C# using the Invoke Code activity and Microsoft.Office.Interop.Word (you need to add it in Imports of your project). Basically the code just created a new Word session, opened the Word document and saved it as PDF. It seemed to be working without problems like experienced with the Word Application Scope and PDF activity.

Unfortunately I do not have access to the repo anymore so I cannot provide the exact code I used. But if you’re familiar with VBA you can also write the code snippet in VB.NET.

In either case you might need to change the .xaml file of your project to get the Microsoft.Office.Interop.Word to work by adding the AssemblyReference (not sure if it was ever fixed by UiPath). You can find more details here: