To identify the type of OS, we can use macro code. In this article we will learn how to determine the type of operating system being used using VBA code.
Question: I would like to know the OS of my system through VBA code whether it is 32 bit or 64 bit.
To determine the type of operating system we need to follow the below steps:
Function OSis32BIT() As Boolean OSis32BIT = False If InStr(Application.OperatingSystem, "32-bit") Then OSis32BIT = True End If End Function
Function OSis64BIT() As Boolean OSis64BIT = False If InStr(Application.OperatingSystem, "64-bit") Then OSis64BIT = True End If End Function
Sub TestOSis32BIT() If OSis32BIT Then MsgBox "You use a 32bit operating system", , _ Application.OperatingSystem Else MsgBox "You don't use a 32bit operating system", , _ Application.OperatingSystem End If End Sub
As you run the macro you will get a message box, refer to the below snapshot:
If you are using 64 bit operating system then the message box will update "You don't use a 32bit operating system"
To check whether the system is 32 bit; we can use UDF in an empty cell as:
To check whether the system is 64 bit; we can use UDF in an empty cell as:
Conclusion: In this way using VBA code, we can identify the operating system we are using.
If you liked our blogs, share it with your friends on Facebook. And also you can follow us on Twitter and Facebook.
We would love to hear from you, do let us know how we can improve, complement or innovate our work and make it better for you. Write us at info@exceltip.com
The applications/code on this site are distributed as is and without warranties or liability. In no event shall the owner of the copyrights, or the authors of the applications/code be liable for any loss of profit, any problems or any damage resulting from the use or evaluation of the applications/code.
This is not exactly true. It depends on what version of the application is installed. 32-bit Excel installed on a computer running 64-bit Windows 10 returns "Windows (32-bit) NT :.00". So it appears that it returns the version of the application, not the version of the operating system.