Allowing autotexts with Enter Keybinding

T

Tweek

Hi all,

I'm using a KeyBinding to remap the Enter key to call a macro in a
template I'm working on. Unfortunately, this prevents Autotexts from
working as expected. Specifically, when the tooltip pops up on the
screen displaying the Autotext detected and says "Press Enter to
insert", the Autotext isn't inserted when Enter is pressed.

Is there any way to programmatically detect if this tooltip is being
displayed when my macro gets called? Or will I have to write the logic
to determine if there is an autotext code to the left of the cursor
when the enter key is pressed and replace it with the text?
Thanks much!
 
C

Charles Kenyon

You can use the F3 key instead of Enter to insert the AutoText. Not quite as
nice, but I would expect multiple problems binding a macro to the Enter key!
Why not use Alt-Enter or one of the function keys instead?
 
T

Tweek

I'm attempting to prevent users from using empty paragraphs to create a
line space between paragraphs. When the editor presses enter, the macro
checks to see if the previous paragraph is empty. If it is, it changes
the style of the paragraph to a style I've created called "Body Text
Space Above".

Since remapping the enter key seems problematic, I am now considering
creating a "preflight" macro which will run when the editor finishes
their document instead. It would go and look for the empty paragraphs,
delete them, and change the following paragraph to the "Space Above"
style. My goal is to try not to make too many changes to the way the
users work.

Any other suggestions?
 
J

Jean-Guy Marcil

Tweek was telling us:
Tweek nous racontait que :
I'm attempting to prevent users from using empty paragraphs to create
a line space between paragraphs. When the editor presses enter, the
macro checks to see if the previous paragraph is empty. If it is, it
changes the style of the paragraph to a style I've created called
"Body Text Space Above".

Since remapping the enter key seems problematic, I am now considering
creating a "preflight" macro which will run when the editor finishes
their document instead. It would go and look for the empty paragraphs,
delete them, and change the following paragraph to the "Space Above"
style. My goal is to try not to make too many changes to the way the
users work.

Any other suggestions?

Why not create a basic style that includes a space after? This way users
will not have to hit Enter twice to get a space between paragraphs. If they
do, they will end up with a much too large and will learn to stop hitting
Enter twice after having to backspace every time... I think in the long run
it pays to educate users a bit.

If your case is hopeless, then, you can hijack the save event by creating
FilseSave and FileSaveAs macros (With those exact names) that will wither
just save the document or call the Save As dialog, but that will also call a
sub that does the job you need to do before saving the document. This way,
whenever the file is saved, it will be checked automatically. IN the
FileSaveAs sub, you might want to check if the users has cancelled the
operation before making any changes.

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top