G
Greg Maxey
I received some assistance (a lot of assistance) with the following code
intented to make the enter key emulate the TAB key in a protected form. It
does a great job cycling between fields, but it turns out that "calculate on
exit" and run macors on "entry" "exit" to the fields are not functioning.
Does anyone know what addtional code is required that would emulate these
features using the enter key?
Thanks
Sub EnterKeyMacro()
' Include the following declaration in the Macro module:
'Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Dim myFF As String
If ActiveDocument.ProtectionType = wdAllowOnlyFormFields And _
Selection.Sections(1).ProtectedForForms Then
myFF = Selection.Bookmarks(1).Name
With ActiveDocument.FormFields
If .Item(myFF).Name = .Item(.Count).Name Then
.Item(1).Select
Else
.Item(myFF).Next.Select
End If
Sleep 2
myFF = Selection.Bookmarks(1).Name
Selection.GoTo What:=wdGoToBookmark, Name:=myFF
End With
Else
Selection.TypeText Chr$(13)
End If
End Sub
intented to make the enter key emulate the TAB key in a protected form. It
does a great job cycling between fields, but it turns out that "calculate on
exit" and run macors on "entry" "exit" to the fields are not functioning.
Does anyone know what addtional code is required that would emulate these
features using the enter key?
Thanks
Sub EnterKeyMacro()
' Include the following declaration in the Macro module:
'Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Dim myFF As String
If ActiveDocument.ProtectionType = wdAllowOnlyFormFields And _
Selection.Sections(1).ProtectedForForms Then
myFF = Selection.Bookmarks(1).Name
With ActiveDocument.FormFields
If .Item(myFF).Name = .Item(.Count).Name Then
.Item(1).Select
Else
.Item(myFF).Next.Select
End If
Sleep 2
myFF = Selection.Bookmarks(1).Name
Selection.GoTo What:=wdGoToBookmark, Name:=myFF
End With
Else
Selection.TypeText Chr$(13)
End If
End Sub