Hi there!

I have a template that contains tables in which are hidden rows with form fields. There is a macro which hides the rows if there is no input in the form fields. If the user changes his mind and wants to give input, there is a macro which unhides the rows.
But now there is a problem because tabbing through form fields selects also the hidden form fields. In order to fix this I have the following macro that is assigned to every form field on entry. But instead of jumping from one unhidden form to next unhidden form, it stops somewhere in between selecting a form field even if it is hidden. If I debug this code going step by step, everything works fine. Any solution, please?

Efto

[vba]
Sub TabUnhidden()

If ActiveDocument.ProtectionType <> wdNoProtection Then
ActiveDocument.Unprotect Password:=""
End If
If ActiveWindow.View.ShowAll = False Then
If ActiveWindow.View.ShowHiddenText = False Then
If Selection.Font.Hidden = True Then
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 If
End If
If ActiveDocument.ProtectionType = wdNoProtection Then
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, _
NoReset:=True
End If
End Sub
[/vba]