LrngToFly
Posts: 16
Joined: Fri Nov 03, 2017 6:28 pm

determine bitness of Office

Hi all-

I need to copy in one version of an Access .mdb file if 32 bit Office is installed and another version of a .mdb file if 64 bit Office is installed. There are VBA macro differences between the two files for the two bitnesses.

Anyone know how I can determine what bitness of Office is installed no matter what version of Office (2013,2016, 2019 etc.)

Thanks!
Catalin
Posts: 6592
Joined: Wed Jun 13, 2018 7:49 am

Re: determine bitness of Office

Hello,

I think that there are two cases that we should take into consideration here:

1- If the Windows OS is a 32-bit OS ==> the Office must be of 32-bit as well. The condition for this can look like this:

Code: Select all

NOT VersionNT64
"VersionNT64" is the property indicating that the Windows OS architecture is of 64-bit. Negating it will mean that the OS architecture is of 32-bit.

2- Now if the OS architecture is of 64-bit, there can be two more cases:

- If Office is of 64-bits, it will write information under the following hive key:

HKEY_LOCAL_MACHINE\SOFTWARE\...\...\....

- If Office is of 32-bits, it will write information under the following hive key:

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\...\...\...

I think that in the second case, you could proceed as it follows in order to see if Office is of 32-bit or 64-bit:

- Create two registry searches for the two versions of Office and based on the result of the search, decide which .mdb file to be copied.

In what regards to the result of the search, for instance, if you are going to use a "registry key exists" search, there can be two cases:

- the property that stores the search result is 1 if it was successful.
- the property that stores the search result is empty if it does not find the registry key.

Based on what was said above, the condition can look like this:

Move the .mdb file if:

Code: Select all

SEARCH_PROPERTY="1"
Also, as an important note: This may get a little bit troublesome, since I think that every version of Office will write to different registry entries. With that being said, you may need to create 2 searches for every version of Office out there.

Hope this helps.

All the best,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
LrngToFly
Posts: 16
Joined: Fri Nov 03, 2017 6:28 pm

Re: determine bitness of Office

This seems to be a reliable key for the last several versions of Office to determine bitness:

Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\ClickToRun\Configuration
Catalin
Posts: 6592
Joined: Wed Jun 13, 2018 7:49 am

Re: determine bitness of Office

Hello,

Thank you for your followup on this. I am sure this will be of help for further users facing a similar scenario (where they need to figure out the bitness of an Office version).

All the best,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”