Skip to main content


         This documentation site is for previous versions. Visit our new documentation site for current releases.      
 

MicrosoftWord connector

Updated on October 19, 2022

Use the MicrosoftWord connector in automations to write and read text from bookmarked documents or templates.

When you add this component to an automation, the system places it in the Globals container for the project, so it can be referenced by other automations in the project.

Properties

PropertyDescription
Changes

Specifies the Save Changes action that you want the system to take when the document is closed. The options are:

  • Save: Changes are saved when the document is closed.
  • DoNotSave: Changes are not saved when the document is closed.
Document

Use the Document property to specify the file name of the document that you want to use in the solution. You must specify a document to use the component. By default, Robot Studio looks at the exact file path selected. However, the Folder property lets you determine the folder file path that is resolved at runtime using predefined tokens. You select these tokens from a list that includes options such as Deployment, Temporary, and System. The folder file path is then resolved by the selected token instead.

Document property

ModeMode governs how the connector file is opened. When set to Create (the default), Robot Studio creates a file if it does not already exist. The Open setting ensures a file is not created, but tries to open the designated file instead. If there is no document present when Robot Studio tries to open it, the system shows an error message.
TemplateUse the Template property to specify the template you want to use in the solution. You can either work withdocuments or templates. The Folder property works the same for a template or a document.
SupportedNameIndicates the corresponding Microsoft Office name for the Word program in the automation.
SupportedVersionDisplays the version number of the Word program in the automation.
VersionIndicates the current running version of Microsoft Word.
VisibleVisible is a Boolean property that indicates whether or not the main Word window is visible during solution runtime.
WordApplicationMicrosoft Word COM instance.
WordDocumentMicrosoft Word document COM instance.

Methods

MethodDescriptionParametersResult type
CloseCloses a currently opened document. NoneVoid
Open (1 Parameter)Opens a new document using the file name that you enter. String document Void
ResetStateResets all component properties to their initial values.NoneVoid
RunMacro (1 Parameter) Runs a Visual Basic macro or calls a function. String Macroname Object
RunMacro (6 Parameters) Runs a Visual Basic macro or calls a function. All param1-param5 parameters are optional. String + Optional ParametersObject
SaveSaves the currently opened document. Returns a True result if the document is successfully saved. NoneBoolean
SaveAsSaves the currently opened document under a new file name. If you do not specify the path, the document is saved in the My Documents folder for the user. Returns a True result if the document is successfully saved. String Filename Boolean

Events

EventDescription
AfterMailMergeOccurs after a mail-merge operation ends.
BeforeMailMergeOccurs before a mail-merge operation ends.
DocumentChangedOccurs when the automation creates a document, opens a document, or makes another document the active document.
DocumentClosedOccurs when the automation closes the current document.
DocumentOpenedOccurs when the automation opens a document.
DocumentPrintedOccurs when the automation prints the current document.
DocumentSavedOccurs when the automation saves the current document.
NewDocumentOccurs when the automation creates a document.
QuitOccurs when the automation closes the main Word window manually.
SelectionChangeOccurs when the current document selection changes.
WindowActivateOccurs when the automation activates the Word main window.
WindowDeactivateOccurs when the automation deactivates the Word main window.

Have a question? Get answers now.

Visit the Support Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega.com is not optimized for Internet Explorer. For the optimal experience, please use:

Close Deprecation Notice
Contact us