Check Office Version 32bit or 64bit VBA code example

Check Office Version 32bit or 64bit VBA code example

Office Code Compatibility

There are scenarios where developer needs to verify existing code which is well running on one machine, stops working upon distribution to other machine mostly due to Office Version. This is really frustrating to find the root cause. Microsoft offers inbuilt methods to verify Office built in architecture by which developer can align the code within environment and make it working on any Office.

Check Office Version

Sub CheckOfficeVersion()
    #If Win64 Then
        MsgBox "64-bit Microsoft Office"
    #Else
        MsgBox "32-bit Microsoft Office"
    #End If
End Sub

Output

Mac for Office

Sub CheckMacOfficeVersion()

    #If MAC_OFFICE_VERSION >= 15 Then
      Debug.Print "You are running on Mac 15+"
    #Else
      Debug.Print "You are not running on Mac 15+"
    #End If
    #If Mac Then
      Debug.Print "You are running on a Mac"
    #Else
      Debug.Print "You are not running on a Mac"
    #End If
End Sub

Please leave your comments or queries under comment section also please do subscribe to out blogs to keep your self upto date.

Leave a Reply

Your email address will not be published. Required fields are marked *