How to check if Microsoft Office is installed during an installation

Sometimes it can be useful to check if Microsoft Office is installed in a computer during an installation. There are conditions available in Visual Installer’s script language that can be used for this. The conditions in the script language can examine the following:

• check whether Microsoft Office is installed in the computer or not
• check if the installed Microsoft Office is 32 bit or 64 bit

This can be useful if you for example:

• install files that require that Microsoft Office is installed in the computer
• install files that require a specific bitness of Microsoft Office (for example 32 bit Office)
• want to install different files depending on the bitness of Microsoft Office

How to check if Office is installed
If you want to check if Microsoft Office is installed in the end-user’s computer you can use the IF OFFICEINSTALLED condition in Visual Installer’s script language for this purpose. If you want to check the opposite, if Microsoft Office is not installed in the computer , you can use the IF NOT OFFICEINSTALLED condition instead.

Below you can see how these two conditions can be used:

The 'IF OFFICEINSTALLED' condition

How to check Office bitness
There are 32 bit and a 64 bit versions of Microsoft Office available, and if you distribute executable files or components that co-operate with Microsoft Office (for example with Microsoft Excel or Microsoft Access) the bitness of the executable files or components that you install must often be the same as the bitness of the installed Office.

To handle this in a smooth way, you can use a another condition in Visual Installer’s scripting language. The name of the condition is IF OFFICEBIT=?? where ?? can be 32 or 64. For example IF OFFICEBIT=32, which checks if a 32 bit version of Office is installed.

Below you can see how this condition can be used:

The 'IF OFFICEBIT=' condition

Another example
Below is another example, where the conditions above are combined. First the script lines checks if any version of Office is installed in the computer, and thereafter the script lines starts an installation with the same bitness (32 bit or 64 bit) as the installed Office:

All Office check conditions altogether

If no Office application is installed in the system, an information message box is shown (line 4) and the installation stops (line 5).

See also
> Visual Installer’s Scripting Language
> Check if the operating system is 32 bit or 64 bit