Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / April 2005

Tip: Looking for answers? Try searching our database.

How to detect if autotext entry is showing?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
hstijnen - 07 Apr 2005 14:33 GMT
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
Jean-Guy Marcil - 07 Apr 2005 14:52 GMT
hstijnen was telling us:
hstijnen nous racontait que :

> Hi,
>
[quoted text clipped - 4 lines]
> 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....

Signature

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

hstijnen - 07 Apr 2005 15:25 GMT
Thanks, Jean-Guy,

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

> hstijnen was telling us:
> hstijnen nous racontait que :
[quoted text clipped - 21 lines]
> current document template and all global templates). Way too much
> overhead....
Jean-Guy Marcil - 07 Apr 2005 19:42 GMT
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?

Signature

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

hstijnen - 08 Apr 2005 08:01 GMT
...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

> hstijnen was telling us:
> hstijnen nous racontait que :
[quoted text clipped - 8 lines]
>
> Again, what are you trying to do?
Jean-Guy Marcil - 08 Apr 2005 16:36 GMT
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?

Signature

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

hstijnen - 25 Apr 2005 13:39 GMT
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

> hstijnen was telling us:
> hstijnen nous racontait que :
[quoted text clipped - 7 lines]
> Interesting...
> If you have 5 minutes and don't mind, could you share your code?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.