Handle word pop ups while running an automated code using Interop

Tanmayee Kandregula 0 Reputation points
2021-08-18T05:46:10.953+00:00

We have .NET automation code for processing a word document - this is being invoked from Automation Anywhere. Using the Interop's 'word.DisplayOptions' method, most of the anticipated pop ups have been handled, however, there are few intermittent pop ups at word application level which is causing our automated run to fail. Please give me some suggestions to handle such issues.

Requirement: Make formatting changes in word document and add relevant comments based on flags set in excel sheet. This .NET code is invoked by a bot after certain conditions are met. However, when there is any word document level pop up , bot is unable to handle it and hence fails.

For now, we have the following code which handles pop ups and other such alerts at microsoft word level. MsWord.Application wdApplication = new MsWord.Application(); wdApplication.AutomationSecurity = Microsoft.Office.Core.MsoAutomationSecurity.msoAutomationSecurityForceDisable; wdApplication.DisplayAlerts = WdAlertLevel.wdAlertsNone;

However, when there are pop ups at application level, there is no way I could figure out. The text in pop up: 'Duplicate file is already open by someone and hence cannot be processed';'Call was rejected by callee';'Microsoft Office can't find your license for the repair attempt';'The file is read-only. Do you wish to save it?'

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,032 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.