Determining If OS Is 32-Bit Or 64-Bit Using VBA

CaliKidd

Board Regular
Joined
Feb 16, 2011
Messages
173
Is there a way (perhaps using Win32API or Win64API) to determine if a system is running a 32-bit or 64-bit operating system? For example, I am running Win 7 64-bit and when I click on Computer-Properties, it shows:

System Type: 64-bit Operating System.

I'd like to capture that info via VBA, if possible. It would be helpful since there are 32-bit and 64-bit versions of the newer OS's.
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Code:
Function Is64bit() As Boolean
    Is64bit = Len(Environ("ProgramW6432")) > 0
End Function
 
Upvote 0
Thank you! Interesting... It seems like the logic is the OS is 64-bit if "C:\Program Files" is the program directory and 32-bit if "C:\Program Files (x86)" is the case.
 
Upvote 0
I just looked it up. The logic seems to be if that environment variable returns anything or not, as that parameter probably doesn't exist in the 32-bit version.
 
Upvote 0

Forum statistics

Threads
1,214,907
Messages
6,122,183
Members
449,071
Latest member
cdnMech

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top