Word Application Scope in a RDA solution (Attended)

Hi guys.

I am making an RDA solution (attended robot). The use case as following:

The robot fills a template in word with Word Application Scope and Set Bookmark Content.

This all works great. But a problem occurs when the user has an open word document. When the Word Application Scope is finish, the robot closes all word documents. This is a major issue as the robot as mentioned is attended. Even worse, if one of said word documents are unsaved, the robot freezes as the robot can’t close the document.

I hope anyone has a solution!

Thanks guys!

Hi @Toke_Lau_Jacobsen,

Welcome to the forum :slight_smile:

Please check the below posts.
How to close only a specific Word document when the Word Application Scope ends and not close Word for other open documents?

Word doc keeps closing

Thank you for the welcome! :smiley: I have been here for years though but I simple got a new email address and therefore had to create a new user.

Yes, I have checked out that thread, but I am not sure this solves my problem. It might also be that I don’t fully understand the solution in the beforementioned thread.

I am unable to use the attach window-activity as I am using the Set Bookmark Content-activity, which can only live within a Word Application Scope.

But Word Application Scope has zero properties that can be used, such as an output window. And as soon as the Word Application Scope is finished all occurences of Word is closed - also any Word windows that might be open before the robot was executed.


CloseSpecificWordFile.zip (28.3 KB)
You can also parameterize the title value to current word file name in your Attach Window selector.

Hope this helps :slight_smile:

I really appreciate your answer. Turns out I really did not understand the Attach Window-solution.

I does - however - not solve my problem. The underlying problem - that the Word Application Scope closes word documents that are already open.

Assume the user has a document open already - document A.

The user then run the robot. The robot performs an word application scope activity which opens another document - document B. When the word application scope is finished, the robot closes both document A and B.

I tried running your sample and the same happens. I wanted to share this, but as a new user I am unable to upload document.

Hi @Toke_Lau_Jacobsen,

  1. Add Word Application Scope and provide document B path

  2. Add Attach Window activity inside the Word Application Scope and provide document B path in the selector field.

  3. Create an output variable for your Attach Window activity. Application Window → attachWindowOutput

  4. Perform Set Bookmark action inside Attach Window (As per your scenario).

  5. Add Close Window Activity.

  6. Then, In Close Window Properties panel, assign UseWindow → attachWindowOutput

This should close your document B only.


Hi @Yogesh_Sanap

Thanks for you continues replies.

How does this solution differ from the workflow you posted earlier?

Hi @Toke_Lau_Jacobsen,

Could you please provide detailed stepwise screenshots along with the property values? or upload the workflow file if possible.

Hi @Yogesh_Sanap,

Once again, I am very happy for your answer. Yesterday I was unable to upload my workflow (because of my new user status) but today I am. Here we go.

CloseSpecificWordFile_Revisited.zip (55.1 KB)

I have used your code as a template. When the word application scope is finished executing one or more of the initial word documents will be closed with the Test File.docx

Hi @Toke_Lau_Jacobsen,

I think Word Application Scope will close all existing word files as per it’s documentation

probably you can try to Invoke Code for programmatically setting a bookmark content

@loginerror might be able to help more :slight_smile:


Hi @Toke_Lau_Jacobsen

I’ll send your comment to our team so that they have a look. I checked it myself on image and it indeed tries to close all files (the freeze on an unsaved file happens because word asks you to save the file).

This does not sound like expected behaviour.

Thank you very much. We also found this behavior very strange and very inconvenience for an attended robot.

1 Like