Objective
The objective of this practice problem is for the user to demonstrate an understanding of the word commands discussed in the previous section by creating an automation that utilizes said commands. The commands covered in the previous section were the Create Word Application, Save Document, Save Document as and Close Word Application commands. In the future, these commands may be implemented into other practice problems.
Scenario
An employee of the ABC company accesses a word document from the company database containing important classified information about a project. The document must be opened and then saved under a new name to the specific project folder to be accessible by the managing authorities.
Prerequisites
The user must use a pre-existing word document (.docx) to use before starting work on the solution. The word application/document must be closed when the process begins. Below is a screenshot of the word document that was created for this problem, feel free to recreate it or create a sample unique file. Feel free to delete this file when finished with the exercise, although this will mean that the automation cannot be run again.
Practice Problem Requirements
The user must create an automation that performs the following tasks:
- Opens a word document (existing file) that is visible while the automation is running.
- Save a copy of the document with a different name in a separate folder (the user can decide which folder the file is saved to if it is not the original folder)
- Close the word Instance once the other commands have been completed.
Problem Difficulty: Very Easy
Solution will be provided on the next page with a brief explanation.
Solution
The code for the solution has been provided below.
As a quick summary:
Step 1: The Create Word Application command must be called first because it tells the automation that it needs open the word document. The visibility and close Instances fields can both be set to yes or otherwise.
Step 2: The Save Document As command will allow the specified word file to be saved under a user designated name in the specified file location.
Step 3: The Close Word Application command will allow the word application to be closed as it is no longer needed. The Save on Close field is set to no because the file has already been saved.