![]() |
#1
|
|||
|
|||
![]()
I have a document that has Fields for the user to edit. One of the things I've found useful is to capture when the user presses "Enter" and run some code:
On Document_Open I have the following: Code:
KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyReturn), _ KeyCategory:=wdKeyCategoryMacro, Command:="EnterKeyMacro" Code:
Sub EnterKeyMacro() 'Check whether the document is protected for forms and whether the protection is active. If ActiveDocument.ProtectionType = wdAllowOnlyFormFields And Selection.Sections(1).ProtectedForForms = True Then 'Retrieve the bookmark of the current selection. This is equivalent to the name of the form field. myformfield = Selection.Bookmarks(1).Name 'Go to the next form field if the current form field is not the last one in the document. If ActiveDocument.FormFields(myformfield).Name <> ActiveDocument.FormFields(ActiveDocument.FormFields.Count).Name Then ActiveDocument.FormFields(myformfield).Next.Select Else 'If the current form field is the last one, go to the first form field in the document. ActiveDocument.FormFields(1).Select End If End If End Sub How can I get the 'other' document to respond to the keypress of ENTER? Thanks! |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
tinfanide | PowerPoint | 1 | 03-16-2013 10:13 AM |