How to find Your VBA Version?
The below code will get the VBA version detail using pre-compiler directives. We cannot display the value in thee variables. But it can be used inside the #IF. Then we can print the required values. Here is the code that can fetch VBA version along with Operating system installation bytes detail as well.Function findVBAversion() As String
Dim vbaVersion As String
'Find VBA version
#If VBA6 Then
vbaVersion = "v6"
#ElseIf VBA7 Then
vbaVersion = "v7"
#ElseIf Mac Then
vbaVersion = "Mac"
#End If
'Check if 64-bit or 32-bit
#If Win64 Then
vbaVersion = vbaVersion & ",64-bit"
#ElseIf Win32 Then
vbaVersion = vbaVersion & ",32-bit"
#Else
vbaVersion = vbaVersion & ",16-bit"
#End If
'Return Value
Debug.Print vbaVersion
findVBAversion = vbaVersion
End Function
Sometimes, the code could run in a iOS environment also. That is why a display condition is added to identify Mac computers as well. This is tested in Excel macro coding environment. It should work in other office VB editors as well.