Function Shift Pressed not working in Excel 2007

B

Barb Reinhardt

I'm sure someone here steered me to this function when I was having some
issues programmatically opening excel workbooks when the shift key was
pressed. I've just migrated to Office 2007 and this function isn't working.

'Declare API
Declare Function GetKeyState Lib "User32" _
(ByVal vKey As Integer) As Integer
Const SHIFT_KEY = 16
Function ShiftPressed() As Boolean
'Returns True if shift key is pressed
ShiftPressed = GetKeyState(SHIFT_KEY) < 0
End Function

Can someone assist?

Thanks,
Barb Reinhardt
 
B

Barb Reinhardt

I just figured out the problem. The function IS working, but it takes a
while to open the file now and by then, the Shift key may be pressed again.
Not sure how to handle that though. Any ideas?
 
Top