Results 1 to 5 of 5
  1. #1
    Platinum Lounger
    Join Date
    Dec 2000
    Location
    Queanbeyan, New South Wales, Australia
    Posts
    3,730
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Tab key behaviour in protected forms

    Hi,

    I have a protected form with form fields and some unprotected sections.

    What I would like to achieve is for the tab key to behave in the same way in the unprotected sections as is does in form fields- ie, go to the next field/section; and for shift + Tab to go backwards.

    I had always assumed I couldn't do it.

    I was doing some fiddling around- and I don't know what I did- but it all behaved correctly, as I wanted.

    I closed the form, and opened it again- but it was back to the "normal" behaviour of inserting a tab in the text.

    Any ideas as to what I did right?
    Subway Belconnen- home of the Signboard to make you smile. Get (almost) daily updates- follow SubwayBelconnen on Twitter.

  2. #2
    Silver Lounger Charles Kenyon's Avatar
    Join Date
    Jan 2001
    Location
    Sun Prairie, Wisconsin, Wisconsin, USA
    Posts
    2,048
    Thanks
    124
    Thanked 119 Times in 116 Posts

    Re: Tab key behaviour in protected forms

    No idea. However, you can simulate this behavior using tables to hold your form. I use the F11 key a lot because I tend to use macrobutton fields (with no macro) for prompts and/or default text in non-protected forms. I usually put a hidden text reminder (in a bright color in a textbox) to use the F11 key to move from field to field.

    Hope this is of some help,
    Charles Kyle Kenyon
    Madison, Wisconsin

  3. #3
    Platinum Lounger
    Join Date
    Dec 2000
    Location
    Queanbeyan, New South Wales, Australia
    Posts
    3,730
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Tab key behaviour in protected forms

    Charles,

    That looked quite promising, but it didn't work as I expected.

    I had a table which had some fixed text and some data entry rows. I inserted section breaks before and after the row where I wanted data entered, then unprotected section 2 when I protected for forms. (I had form fields in subsequent rows).

    When I pressed the tab key, instead of inserting a tab character or moving to the next row, it inserted a new row in the table- the same as would have happened in the last row of an unprotected table. This also why I put in unprotected rows later in the table.

    I don't want to use Macrobutton fields, as I want to make sure that protected text cannot be overtyped at all; it also looks as if overtyping gets rid of the macrobutton field, which makes backward navigation difficult.

    I was looking at unprotected sections because they give the flexibility of enabling formatting (which form fields do not). A form field (or ActiveX control/any other mechanism) giving complete control over formatting, whilst stopping any modification to the rest of the document, would give me what I'm after (are you listening Microsoft?).

    I may take up your idea of putting hidden text as a reminder- then assigning a function key to a "next section" macro- even perhaps to the tab key?
    Subway Belconnen- home of the Signboard to make you smile. Get (almost) daily updates- follow SubwayBelconnen on Twitter.

  4. #4
    Platinum Lounger
    Join Date
    Dec 2000
    Location
    Queanbeyan, New South Wales, Australia
    Posts
    3,730
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Tab key behaviour in protected forms

    I've got a partial VBA solution here. It assigns "GotoNextSection" to the Tab key, and "GoToPrevSection" to Shift + Tab.

    It does need refining for shift + tab- if it's in a section, and shift+tab gets pressed, it goes to the first form field in the section- but it works heaps better than nothing at all.

    <pre>Option Explicit

    Sub InitialiseTemplate()
    CustomizationContext = ActiveDocument.AttachedTemplate
    ActiveDocument.Unprotect
    KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyTab), _
    KeyCategory:=wdKeyCategoryMacro, Command:="GotoNextSection"
    KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyShift, wdKeyTab), _
    KeyCategory:=wdKeyCategoryMacro, Command:="GotoPrevSection"
    ActiveDocument.Protect Type:=wdAllowOnlyFormFields, noreset:=True
    End Sub

    Sub GotoNextSection()
    Selection.GoTo What:=wdGoToSection, Which:=wdGoToNext, Count:=1, Name:=""
    End Sub

    Sub GotoPrevSection()
    Selection.GoTo What:=wdGoToSection, Which:=wdGoToPrevious, Count:=2, Name:=""
    End Sub
    </pre>

    Subway Belconnen- home of the Signboard to make you smile. Get (almost) daily updates- follow SubwayBelconnen on Twitter.

  5. #5
    Silver Lounger Charles Kenyon's Avatar
    Join Date
    Jan 2001
    Location
    Sun Prairie, Wisconsin, Wisconsin, USA
    Posts
    2,048
    Thanks
    124
    Thanked 119 Times in 116 Posts

    Re: Tab key behaviour in protected forms

    I've added this thread to my <A target="_blank" HREF=http://www.addbalance.com/word/wordwebresources.htm#Forms> Forms reference links</A>. Thank you.
    Charles Kyle Kenyon
    Madison, Wisconsin

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •