Close Office Application

Closes an opened Word, Excel, or PowerPoint Office application.

Command availability: IBM RPA SaaS and IBM RPA on premises

Script syntax

IBM RPA's proprietary script language has a syntax similar to other programming languages. The script syntax defines the command's syntax in the script file. You can work with this syntax in IBM RPA Studio's Script mode.

officeClose --officeapplication(OfficeApplication)


  • To use this command, open an Office file with the Open Office file (officeOpen) command.

  • Microsoft™ Office 2010 or higher is required.

  • Ensure that the architecture (bitness) of your Office apps, IBM RPA, and your operating system match. For example, if you are using a 64-bit operating system, IBM RPA and Office must be 64-bit too.

Input parameters

The following table displays the list of input parameters available in this command. In the table, you can see the parameter name when working in IBM RPA Studio's Script mode and its Designer mode equivalent label.

Designer mode label Script mode name Required Accepted variable types Description
Office Application officeapplication Required Office Application Office application to be closed.

Remember:The Office application variable is generated by the Office Application output from the Open Office File, Create Office File, and Attach Office Application commands.


The Close Office Application command closes the Excel application, opened by the Open Office File command.

defVar --name excelApplication --type OfficeApplication
officeOpen --path "Sample File" --type "Excel" --keepvisibleexcelApplication=officeapplication
officeClose --officeapplication ${excelApplication}

Important: To use the sample script, use a sample file and enter its path in the File Path parameter of the Open Office File command.