Test if it is a Mac or a Windows Machine

More information about testing the Excel version or Excel language you can find on this page :
Mac Excel version and Mac Office language settings

We use the conditional compiler constants to test the Operating system or test if you run a 32 or 64 bit version of Office.The macro below will test the Operating system, you can replace the msgbox line with your code or Macro call to run the code you want.

Sub WINorMAC_1()
'Test the conditional compiler constant #Mac
#If Mac Then
'I am a Mac
MsgBox "Call Mac_Macro"
#Else
'I am Windows
MsgBox "Call Windows_Macro"
#End If
End Sub

Office 2011 for the Mac is always 32-bit and Office 2016 for the Mac can be 32 or 64-bit, all builds 15.26 and later are exclusively 64-bit. So, every Mac Office 2016 install that is up to date and every Excel version that is higher are always 64-bit

Below you can find a test macro and three UDF functions that you can use to test the Operating system, test if you run a 32 or 64 bit version of Office and give you the Excel version number.

Sub GetInfo()
MsgBox "You are using a Mac: " & IsMac
MsgBox "Your Office install is 64 Bit: " & Is64BitOffice
MsgBox "Your Excel version is: " & Excelversion
End Sub

Function IsMac() As Boolean
#If Mac Then
IsMac = True
#End If
End Function

Function Is64BitOffice() As Boolean
#If Win64 Then
Is64BitOffice = True
#End If
End Function

Function Excelversion() As Double
'Win Excel versions are always a whole number (16)
'Mac Excel versions show also the number of the update (16.43)
Excelversion = Val(Application.Version)
End Function
10-February-2021
Web design by Will Woodgate