Perry
Tue Feb 06 15:34:22 CST 2007
Oh did I understand yr contributions, I sure did :-)
I just thought the code was more or less self explanatory but for other
readers, will give
some addtl explanation.
> Is bALTPressedFirst some sort of VBA constant?
Static bALTPressedFirst As Boolean
expl: Declared static; keeps value next time the event fires.
bALTPressedFirst = (KeyCode = 18)
expl: Last line in eventprocedure determines whether ALT (KeyCode = 18) was
pressed.
So next time event fires and ALT was pressed (static variable
bALTPressedFirst = True )
only thing needs to be done is catch keycode for [e] has.
If [e] was pressed, the last line will reset static variable
bALTPressedFirst to False....etc.
Can't catch Keycode for CTRL; there's no system callback for CTRL.
Krgrds,
Perry
"Jean-Guy Marcil" <DontEvenTry@NoSpam> wrote in message
news:O4wtwsgSHHA.3500@TK2MSFTNGP05.phx.gbl...
> Perry was telling us:
> Perry nous racontait que :
>
>>> Of course it works.. I did not doubt the validity of your code, I was
>>> genuinely interested in understanding the behind the scene stuff...
>>
>> :-)
>> No probs if you were, Jean-Guy.
>>
>> My point: it worked for OP, and I've come to believe due to being in
>> the bizz
>> for quite a time now: elegant/ideal solutions don't always matter ...
>> (you know)
>> Having looked at the code, after I posted, there WAS one line
>> questionable. Indicated in below sequence...
>>
>> Krgrds,
>> Perry
>>
>>
>> Static bALTPressedFirst As Boolean
>> If bALTPressedFirst Then
>> If KeyCode = 69 Then
>> MsgBox "ALT E pressed "
>> bALTPressedFirst = False '<<< obsolete
>> End If
>> End If
>
> Perry, I think you do not understand my posts in this thread... :-)
>
> I know the code works ( I tested it) and I could leave it at that.
> But being who I am, I can't let it go until I understand what is going
> on... I need/want to understand HOW it works, .
>
> I want to know how a keypress (Using ALT or not) affects the value of a
> variable in a Sub (bALTPressedFirst = True or False).
> Is bALTPressedFirst some sort of VBA constant?
> What If I wanted to test for CTRL being pressed or not?
>
> --
>
> Salut!
> _______________________________________
> Jean-Guy Marcil - Word MVP
> jmarcilREMOVE@CAPSsympatico.caTHISTOO
> Word MVP site:
http://www.word.mvps.org
>