Hi,

I have defined some autotext entries: when I type some text, the autotext
entry is showing, and when I hit Enter the entry is inserted in the document.

Now I have created a KeyBinding for the Enter key: when the Enter key is
hit, a specific macro is executed. My question is: how can I detect in that
macro if the autotext entry is showing?

Thanks for help

Henk

Re: How to detect if autotext entry is showing? by Jean-Guy

Jean-Guy
Thu Apr 07 08:52:09 CDT 2005

hstijnen was telling us:
hstijnen nous racontait que :

> Hi,
>
> I have defined some autotext entries: when I type some text, the
> autotext entry is showing, and when I hit Enter the entry is inserted
> in the document.
>
> Now I have created a KeyBinding for the Enter key: when the Enter key
> is hit, a specific macro is executed. My question is: how can I

What are you doing with the Enter key?
As a user it would bother me in the extreme if my Enter key did not act as
expected....
This is why I never bind it.

> detect in that macro if the autotext entry is showing?

I do not think you can do that easily.
The only way I can see is to monitor the Selection_Change event, and
consistently check if the last 4 characters are used in the first 4
characters of all autotext entries that are available right now (Normal.dot,
current document template and all global templates). Way too much
overhead....

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org




Re: How to detect if autotext entry is showing? by hstijnen

hstijnen
Thu Apr 07 09:25:02 CDT 2005

Thanks, Jean-Guy,

is there perhaps a way to call the original built-in function of the enter
key in VBA?

"Jean-Guy Marcil" wrote:

> hstijnen was telling us:
> hstijnen nous racontait que :
>
> > Hi,
> >
> > I have defined some autotext entries: when I type some text, the
> > autotext entry is showing, and when I hit Enter the entry is inserted
> > in the document.
> >
> > Now I have created a KeyBinding for the Enter key: when the Enter key
> > is hit, a specific macro is executed. My question is: how can I
>
> What are you doing with the Enter key?
> As a user it would bother me in the extreme if my Enter key did not act as
> expected....
> This is why I never bind it.
>
> > detect in that macro if the autotext entry is showing?
>
> I do not think you can do that easily.
> The only way I can see is to monitor the Selection_Change event, and
> consistently check if the last 4 characters are used in the first 4
> characters of all autotext entries that are available right now (Normal.dot,
> current document template and all global templates). Way too much
> overhead....
>
> --
> Salut!
> _______________________________________
> Jean-Guy Marcil - Word MVP
> jmarcilREMOVE@CAPSsympatico.caTHISTOO
> Word MVP site: http://www.word.mvps.org
>
>
>
>

Re: How to detect if autotext entry is showing? by Jean-Guy

Jean-Guy
Thu Apr 07 13:42:13 CDT 2005

hstijnen was telling us:
hstijnen nous racontait que :

> Thanks, Jean-Guy,
>
> is there perhaps a way to call the original built-in function of the
> enter key in VBA?
>

Not that I know of. The Enter key is pretty standard in all aplications, it
adds line breaks or execute code behind a selected object.

Again, what are you trying to do?

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org




Re: How to detect if autotext entry is showing? by hstijnen

hstijnen
Fri Apr 08 02:01:02 CDT 2005

...what are you trying to do?
I've made a keybinding and macro to intercept the Enter. The goal is when
one is creating a list (bulleted, numbered), and hits Enter when the (last)
item is empty, the list is ended and the correct style is set (to create
distance between text and list). Thisworks pretty well.

BTW, I found that the autotext entry is also inserted when one hits TAB, so
that my problem has disappeared.

Thank you for your interest.

Salut,
Henk

"Jean-Guy Marcil" wrote:

> hstijnen was telling us:
> hstijnen nous racontait que :
>
> > Thanks, Jean-Guy,
> >
> > is there perhaps a way to call the original built-in function of the
> > enter key in VBA?
> >
>
> Not that I know of. The Enter key is pretty standard in all aplications, it
> adds line breaks or execute code behind a selected object.
>
> Again, what are you trying to do?
>
> --
> Salut!
> _______________________________________
> Jean-Guy Marcil - Word MVP
> jmarcilREMOVE@CAPSsympatico.caTHISTOO
> Word MVP site: http://www.word.mvps.org
>
>
>
>

Re: How to detect if autotext entry is showing? by Jean-Guy

Jean-Guy
Fri Apr 08 10:36:55 CDT 2005

hstijnen was telling us:
hstijnen nous racontait que :

> ...what are you trying to do?
> I've made a keybinding and macro to intercept the Enter. The goal is
> when one is creating a list (bulleted, numbered), and hits Enter when
> the (last) item is empty, the list is ended and the correct style is
> set (to create distance between text and list). Thisworks pretty well.

Interesting...
If you have 5 minutes and don't mind, could you share your code?

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org




Re: How to detect if autotext entry is showing? by hstijnen

hstijnen
Mon Apr 25 07:39:01 CDT 2005

Hi Jean-Guy,

By occasion I've found the answer for my Enterkey problem in
http://support.microsoft.com/kb/q187985/

the key code is:
CustomizationContext = ActiveDocument.AttachedTemplate
KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyReturn), _
KeyCategory:=wdKeyCategoryMacro,
Command:="Normal.styles.EnterKeyMacro"

and in Normal.styles.EnterKeyMacro I can place the code I want: if one hits
Enter in a bulleted list and the paragraph is empty, then I only change the
style of the paragraph. In all other cases I do a TypeParagraph.

I run the above code in Normal.dot and then all docs on normal.dot have the
desired binding.

Cheers,

Henk

"Jean-Guy Marcil" wrote:

> hstijnen was telling us:
> hstijnen nous racontait que :
>
> > ...what are you trying to do?
> > I've made a keybinding and macro to intercept the Enter. The goal is
> > when one is creating a list (bulleted, numbered), and hits Enter when
> > the (last) item is empty, the list is ended and the correct style is
> > set (to create distance between text and list). Thisworks pretty well.
>
> Interesting...
> If you have 5 minutes and don't mind, could you share your code?
>
> --
> Salut!
> _______________________________________
> Jean-Guy Marcil - Word MVP
> jmarcilREMOVE@CAPSsympatico.caTHISTOO
> Word MVP site: http://www.word.mvps.org
>
>
>
>