I'm trying to close access (Application.Quit
) after running all functions.
VBA close access after all functions finished has been a reference for me.
but when I Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
, It's giving me the following error:
The code in this project must be updated for use on 64 bit systems.
Is there any replacement of this code to do run all functions before completely closing access?
The dwMilliseconds
parameter is a DWORD, so it will technically be 32bit on a 32bit machine and 64bit on a 64bit machine. Because of this, it requires PtrSafe
notation (although technically dwMilliseconds
will marshal correctly because it's ByVal
... and who wants to wait that long anyway) Change the declaration to this:
#If VBA7 Then
Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As LongPtr)
#Else
Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
#End If
change your api declaration to this :
#If VBA7 And Win64 Then
Private Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
#Else
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
#End If
For 64bit APIs read this: http://www.jkp-ads.com/articles/apideclarations.asp
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With