Greg -- Also
The various data structures required for some APIs are there so they need to be included (I know that you know this)
One later change I think was the including of LongPtr
https://learn.microsoft.com/en-us/of...gptr-data-type
LongPtr is not a true data type because it transforms to a Long in 32-bit environments, or a LongLong in 64-bit environments. Using LongPtr enables writing portable code that can run in both 32-bit and 64-bit environments. Use LongPtr for pointers and handles.
You've probably seen this before, but there are some built in compiler constants that might be useful
' ver 01 10/9/2014
' initial (and probably only)
Option Explicit
Option Private Module
'Compiler Constants
'
'Visual Basic for Applications defines constants for exclusive use with the #If...Then...#Else directive.
' These constants are functionally equivalent to constants defined with the #If...Then...#Else directive except
' that they are global in scope; that is, they apply everywhere in a project.
'
'
' Note
'Because Win32 returns true in both 32-bit and 64-bit development platforms it is important that the order within the
' #If...Then...#Else directive returns the desired results in your code. For example, because Win32 returns True in
' 64-bit (Win32 is compatible in Win64 environments) checking for Win32 before Win64 results in the Win64 condition
' never running because Win32 returns True. The following order returns predictable results:
'
' #If Win64 Then
' Win64=true, Win32=true, Win16= false
' #ElseIf Win32 Then
' Win32=true, Win16=false
' #Else
' Win16=true
' #End If
'
'This applies to both Winx and VBAx constants.
'
'
'On 16-bit development platforms, the compiler constants are defined as follows:
'
'Constant Value Description
'Win16 True Indicates development environment is 16-bit compatible.
'Win32 False Indicates that the development environment is not 32-bit compatible.
'Win64 False Indicates that the development environment is not 64-bit compatible.
'
'On 32-bit development platforms, the compiler constants are defined as follows:
'
'Constant Value Description
'Vba6 True Indicates that the development environment is Visual Basic for Applications, version 6.0 compatible.
' False Indicates that the development environment is not Visual Basic for Applications, version 6.0 compatible.
'Vba7 True Indicates that the development environment is Visual Basic for Applications, version 7.0 compatible.
' False Indicates that the development environment is not Visual Basic for Applications, version 7.0 compatible.
'Win16 False Indicates that the development environment is not 16-bit compatible.
'Win32 True Indicates that the development environment is 32-bit compatible.
'Win64 False Indicates that the development environment is not 64-bit compatible.
'Mac True Indicates that the development environment is Macintosh.
' False Indicates that the development environment is not Macintosh.
'
'On 64-bit development platforms, the compiler constants are defined as follows:
'
'Constant Value Description
'Vba6 True Indicates that the development environment is Visual Basic for Applications, version 6.0 compatible.
' False Indicates that the development environment is not Visual Basic for Applications, version 6.0 compatible.
'Vba7 True Indicates that the development environment is Visual Basic for Applications, version 7.0 compatible.
' False Indicates that the development environment is not Visual Basic for Applications, version 7.0 compatible.
'Win16 False Indicates development environment is not 16-bit compatible.
'Win32 True Indicates that the development environment is 32-bit compatible.
'Win64 True Indicates that the development environment is 64-bit compatible.
'Mac True Indicates that the development environment is Macintosh.
' False Indicates that the development environment is not Macintosh.
Sub WhatVersion()
#If Win64 Then
#If VBA6 Then
msgBox "64 bit and VBA v6.0 compatible"
#ElseIf VBA7 Then
msgBox "64 bit and VBA v7.0 compatible"
#ElseIf Mac Then
msgBox "64 bit and Mac"
#End If
#ElseIf Win32 Then
#If VBA6 Then
msgBox "32 bit and VBA v6.0 compatible"
#ElseIf VBA7 Then
msgBox "32 bit and VBA v7.0 compatible"
#ElseIf Mac Then
msgBox "32 bit and Mac"
#End If
#Else
#If VBA6 Then
msgBox "16 bit and VBA v6.0 compatible"
#ElseIf VBA7 Then
msgBox "16 bit and VBA v7.0 compatible"
#ElseIf Mac Then
msgBox "16 bit and Mac"
#End If
#End If
End Sub