Tony
Thu Oct 27 07:30:41 CDT 2005
With all due respect to Microsoft, what a ridiculous piece of code! It is
trying (and failing) to use the presence of a KeyBinding as a flag and
describing the whole thing with a load of mumbo-jumbo.
The reason it doesn't work is that the Disable method disables (but does not
remove) an active keybinding. It does remove an already disabled one which
explains your results and Jean-Guy's workaround. To remove the keybinding
first time requires the Clear method ..
FindKey(BuildKeyCode(wdKeyControl, wdKeyAlt, wdKeyA)).Clear
--
Enjoy,
Tony
"Jean-Guy Marcil" <NoSpam@LeaveMeAlone> wrote in message
news:euW4c6o2FHA.3420@TK2MSFTNGP15.phx.gbl...
> JFW was telling us:
> JFW nous racontait que :
>
> > I have looked at the article:
> >
http://support.microsoft.com/?kbid=212711
> >
> > It appears to me that there is a bug in this code. When my BEFORE
> > code is Selection.TypeText("1")
> > and my AFTER code is
> > Selection.TypeText("2")
> >
> > then repeat executions of the macro gives this result:
> >
> > 122122122122122122122122122122122122122122
> >
> > If it were conducted properly, the result would be:
> >
> > 1212121212121212121212121212121212121212
> >
> > For some reason it is taking two executions of the macro to clear the
> > keyboard assignation. Any idea why this is?
> >
> > Also, I am interested in knowing if others have a similar result with
> > the repeating 122122122.
> >
> > Thanks for your help.
>
> I am not very good with key assignments (I never really use them... my
> clients always prefer toolbar buttons...)
> I know there are some key assignment wizards hanging around, I am sure
they
> will have an explanation!
>
> Meanwhile, I got it to work by doubling the line
> FindKey(BuildKeyCode(wdKeyControl, wdKeyAlt, wdKeyA)).Disable
> FindKey(BuildKeyCode(wdKeyControl, wdKeyAlt, wdKeyA)).Disable
> and it is frustrating as I cannot tell why that solves the problem.
>
>
> --
> Salut!
> _______________________________________
> Jean-Guy Marcil - Word MVP
> jmarcilREMOVE@CAPSsympatico.caTHISTOO
> Word MVP site:
http://www.word.mvps.org
>
>