VBA 7.1
Office 365, Office 2019
Support for both 32 bit and 64 bit
Office 2016, Office 2013
64 Bit API Changes
Some of the APIs need to be modified slightly if you need to support both 64-bit and 32-bit.
link - jkp-ads.com/articles/apideclarations.asp
API - GetWindowRect
If you need your code to call GetWindowRect on both 32 bit Office and 64 bit Office you need to include two declarations.
Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
#If VBA7 Then
Declare PtrSafe Function GetWindowRect Lib "user32" ( _
ByVal hwnd As LongPtr, _
ByRef lpRect As RECT) As Long
#Else
Declare Function GetWindowRect Lib "user32" ( _
ByVal hwnd As Long, _
ByRef lpRect As RECT) As Long
#End If
API - FindWindow
If you need your code to call FindWindow on both 32 bit Office and 64 bit Office you need to include two declarations.
#If VBA7 Then
Declare PtrSafe Function FindWindow Lib "user32" Alias "FindWindowA" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) As LongPtr
#Else
Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal _
ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
#End If
© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext