So I've run across this issue before and wasn't sure if there was a workaround.
In this example on stackoverflow, (scroll to the end of the comments for the example code, there's an IF statement in the API declarations section that checks for 64 vs 32 bit. On a 64 bit machine, all the code after the "#Else" statement is an error; it's all red. Code hasn't even run yet, Excel just recognizes that there's an issue with it.
Is there a workaround? I do have a 32 bit machine as well and I'd really like to be able to use this spreadsheet on either machine.
Oh, I'll paste the code here if that helps:
Thank you for your help!
Thanks!!
Matt
In this example on stackoverflow, (scroll to the end of the comments for the example code, there's an IF statement in the API declarations section that checks for 64 vs 32 bit. On a 64 bit machine, all the code after the "#Else" statement is an error; it's all red. Code hasn't even run yet, Excel just recognizes that there's an issue with it.
Is there a workaround? I do have a 32 bit machine as well and I'd really like to be able to use this spreadsheet on either machine.
Oh, I'll paste the code here if that helps:
Code:
' API declarations
#If VBA7 And Win64 Then
Private Declare PtrSafe Function GetVersionEx Lib "Kernel32" _
Alias "GetVersionExA" _
(lpVersionInformation As OSVERSIONINFO) As Long
Private Declare PtrSafe Sub keybd_event Lib "user32" _
(ByVal bVk As Byte, _
ByVal bScan As Byte, _
ByVal dwflags As Long, ByVal dwExtraInfo As Long)
Private Declare PtrSafe Function GetKeyboardState Lib "user32" _
(pbKeyState As Byte) As Long
Private Declare PtrSafe Function SetKeyboardState Lib "user32" _
(lppbKeyState As Byte) As Long
#Else
Private Declare Function GetVersionEx Lib "Kernel32" _
Alias "GetVersionExA" _
(lpVersionInformation As OSVERSIONINFO) As Long
Private Declare Sub keybd_event Lib "user32" _
(ByVal bVk As Byte, _
ByVal bScan As Byte, _
ByVal dwflags As Long, ByVal dwExtraInfo As Long)
Private Declare Function GetKeyboardState Lib "user32" _
(pbKeyState As Byte) As Long
Private Declare Function SetKeyboardState Lib "user32" _
(lppbKeyState As Byte) As Long
#End If
Thank you for your help!
Thanks!!
Matt