shift enter

J

jbickel

I need to program the enter key to function like Shift-Enter in MS Word. Can
this be done?
 
G

Greg

Yes, but I wouldn't recommend doing it wholesale :). I would create a
template with the following macros and use it for documents that you want use
this feature for:

Sub AutoNew()

'Assigns the Macro1 Macro to the ENTER Key
CustomizationContext = ActiveDocument.AttachedTemplate
KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyReturn), _
KeyCategory:=wdKeyCategoryMacro, Command:="Macro1"

End Sub
Sub AutoOpen()

'Assigns the Macro1 Macro to the ENTER Key
CustomizationContext = ActiveDocument.AttachedTemplate
KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyReturn), _
KeyCategory:=wdKeyCategoryMacro, Command:="Macro1"

End Sub
Sub AutoClose()

CustomizationContext = ActiveDocument.AttachedTemplate
FindKey(KeyCode:=BuildKeyCode(wdKeyReturn)).Disable
'Disables prompt to save template changes
Templates(1).Save

End Sub

Sub Macro1()
'
' Macro1 Macro
' Macro recorded December 1, 2004 by CDR Gregory K. Maxey
'
Selection.TypeText Text:=Chr(11)
End Sub
 
J

jbickel

I did create the macro but I couldn't find out how to assign it to the enter
key. Now if I understand this right I need to be sure this if the first
macro in my template correct? Since the sub items refer to macro 1??? Is
this correct?

thank you for your response.
 
L

Lesley Regan

Hello, jbickel,

You don't need to make sure the Macro1 macro is first in the template. Try
it and see!

Regards,

Lesley
 
J

jbickel

I have added the following templates to my template (this template is not a
normal template but a templated added through the start-up folder). I have
placed the template in Startup but the shift enter feature is not working.

If I open the template up it works fine. Any thoughts???
 

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