mtheriault2000
Well-known Member
- Joined
- Oct 23, 2008
- Messages
- 826
Hello
I got a conception problem with a verification procedure for calling a macro.
Situation:
I'm building an Excel sheet form to send trade orders. As I'm dealing with real money, I want to add some security to prevent false triggers of an order.
I want to execute a macro when I click over a button and press at the same time the left ctrl key. To do so, I use this function to verify the state of the key.
2 problems:
1- When i use the combinaison of a click over a button and the CTRL left key, Excel entered in Edit mode for the button. Is there a way to prevent that?
2- The GetAsyncKeyState will be triggered if the keyswitch as been press since the last verification. Meaning: If I press the key, then release it, then Click on my button, the GetAsyncKeyState will give true because the ctrl key as been hit.
Question: How could i get a true at the moment key states?
Martin
Hope I'm clear enough
I got a conception problem with a verification procedure for calling a macro.
Situation:
I'm building an Excel sheet form to send trade orders. As I'm dealing with real money, I want to add some security to prevent false triggers of an order.
I want to execute a macro when I click over a button and press at the same time the left ctrl key. To do so, I use this function to verify the state of the key.
Code:
Public Function CTRLKey(bool)
If CBool(GetAsyncKeyState(&HA2)) Then
CTRLKey = True
Else
CTRLKey = False
End If
End Function
1- When i use the combinaison of a click over a button and the CTRL left key, Excel entered in Edit mode for the button. Is there a way to prevent that?
2- The GetAsyncKeyState will be triggered if the keyswitch as been press since the last verification. Meaning: If I press the key, then release it, then Click on my button, the GetAsyncKeyState will give true because the ctrl key as been hit.
Question: How could i get a true at the moment key states?
Martin
Hope I'm clear enough