fumei
Tue May 13 09:25:46 PDT 2008
An excellent response Jonathan.
Just to add my voice. AutoText entries are not, in themselves, executable.
They are the results of an action (inserting them), not actions themselves.
Yes, you could put a MACROBUTTON into one, so the user could execute
something with that. But inserting an AutoText itself will not execute
anything.
Yes, you can do things with the Enter key, but I would concur with Jonathan
that doing this requires careful thought and consideration.
Why not go another route? One macro that inserts the AutoText, then does
whatever else.
Jonathan West wrote:
>> Hello,
>>
>[quoted text clipped - 3 lines]
>> sure there is no way to do this but I just thought I'd ask to be sure. I'm
>> using Office 2003 but 2007 available.
>
>It is possible to assign Enter as a shortcut key to a macro. You can't do it
>through the Tools customize dialog, but you can do it in VBA using the
>KeyBindings collection.
>
>So, what you can do is have the macro insert the autotext entry and then do
>whatever code you want after that.
>
>However, if you are going to do this, you need to be VERY careful how you
>write the macro, since it will be run every time you press Enter whether or
>not the AutoComplete tooltip is showing, which means you have to get the
>macro to do everything Word normally does when you press Enter. There are a
>surprisingly large number of conditions that need to be addressed.
>
>This isn't impossible, but it is a tough task. Unless you really feel you
>must go this route, I would recommend you make inserting the AutoText and
>running the subsequent macro as two separate actions.
>
--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.aspx/word-programming/200805/1