gruntingmonkey
Active Member
- Joined
- Mar 6, 2008
- Messages
- 434
- Office Version
- 365
- Platform
- Windows
Hello Excelheads, I have some old code that I used to use many years ago. I have just loaded on my new work computer and I am getting a compile error:
"Compile error: The code in this project must be updated for use on 64-bit systems. Please review and update Declare statements and then mark them with the PtrSafe attribute."
I have done some looking but don't understand the answers. I think I have to change the first line to something like:
Can anyone point out where I am wrong?
"Compile error: The code in this project must be updated for use on 64-bit systems. Please review and update Declare statements and then mark them with the PtrSafe attribute."
VBA Code:
Declare Function SetCursorPos Lib "user32.dll" (ByVal x As Long, ByVal y As Long) As Long
Sub Command2_Click()
End Sub
''''note this is an endless loop and can only be closed by pressing the ESC key
MsgBox ("WARNING: This macro will cause an infinite loop. Press CTRL+BREAK to exit an infinite loop and then end the debugger")
Do
SetCursorPos 50, 50 '//// sets x & y position of mouse ( in pixels )
Application.Wait Now + TimeValue("00:00:05")
SetCursorPos 500, 500
Loop
End Sub
I have done some looking but don't understand the answers. I think I have to change the first line to something like:
VBA Code:
Declare Function SetCursorPos Lib "user32.dll" (ByVal x As LongPtr, ByVal y As LongPtr) As LongPtr
Can anyone point out where I am wrong?