RPA Microsoft Word Automation -- How To Merge 2 Microsoft Word files

I was recently asked how to merge two Microsoft Word files. Here is a sample automation that you can import into your projects to perform that task. I will be adding more posts with other automations to help with automating Word in the coming days.

A couple of items for your attention:

  • The WordConnector WordDocument property gives you access to all of the properties, methods and events of your document. Extract a proxy from that property and explore the wealth of options available.
  • Many of the methods available in Word have a number of parameters that you may not need or want to provide. The MicrosoftExcel connector has a property called Missing which can be used to supply these parameters (we will add this to the MicrosoftWord connector soon).
  • Many methods require special types of input but you cannot select the input directly on the block. Notice how we use a label to allow for selecting from a Word enum value and then passing that into a method.
  • To learn what enum value to use, refer to Microsoft’s documentation found here- https://docs.microsoft.com/en-us/dotnet/api/microsoft.office.interop.word?view=word-pia. Find the name of the enum and then using the Browse option when adding a parameter navigate to Microsoft.Office.Interop.Word to find the enum by name.

Hope this help you get started doing complex automations in Microsoft Word.

WordMerge.zip (6.21 KB)

Sneak peek of same automation in Pega Robot Studio v21 which is available in preview on Digital Delivery now: