ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Function Shift Pressed not working in Excel 2007 (https://www.excelbanter.com/excel-programming/425519-function-shift-pressed-not-working-excel-2007-a.html)

Barb Reinhardt

Function Shift Pressed not working in Excel 2007
 
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

Barb Reinhardt

Function Shift Pressed not working in Excel 2007
 
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?

"Barb Reinhardt" wrote:

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


Dave Peterson

Function Shift Pressed not working in Excel 2007
 
Maybe Jan Karel Pieterse can:
http://www.jkp-ads.com/Articles/WorkbookOpenBug.asp

Barb Reinhardt wrote:

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


--

Dave Peterson


All times are GMT +1. The time now is 03:38 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com