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 / December 2004

Tip: Looking for answers? Try searching our database.

Shift enter mapping

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
jbickel - 07 Dec 2004 19:57 GMT
I created the Macros as Greg suggested but I am having a problem with it
working.  These macros were added to a template other than Normal.dot and I
have placed the template in the startup folder.  What I am finding is the
first time I open MS Word the macros are not working.  If I closed the
initial document and create a new document the macros work.  Does anyone know
how I can get it working on the document that opens first?

"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"
Peter - 07 Dec 2004 22:14 GMT
In order to have the keybinding happen every time Word runs, you need an AutoExec() Sub that mirrors the AutoNew() and AutoOpen() ones.  Note that since it's in the Startup folder, the keybinding will apply to ALL documents you open.  Hence Greg's suggestion that you use it only for specific documents, and his neglect of AutoExec().

hth,

-Peter

> I created the Macros as Greg suggested but I am having a problem with it
> working.  These macros were added to a template other than Normal.dot and I
[quoted text clipped - 39 lines]
>   Selection.TypeText Text:=Chr(11)
> End Sub"
 
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.