Results 1 to 3 of 3
  1. #1
    5 Star Lounger
    Join Date
    Jul 2001
    Location
    Terneuzen, Netherlands
    Posts
    895
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Keep fields when toggling forms (2000/97)

    Just found this little piece of code that prevents form-fields already filled-in from being reset if a user toggles between form editing and data-entering modes.

    Sub ToolsProtectUnprotectDocument()
    With ActiveDocument
    If .ProtectionType = wdNoProtection Then
    .Protect wdAllowOnlyFormFields, True
    Else
    .Unprotect
    End If
    End With
    End Sub

    It does work but from the Tools / (Un)Protect Document menu only. When editing forms I always use the forms-toolbas and click the lock-button.
    Anybody who can tell me how that command is called so I can change this code to only respond to that click?

    Thanks,

    EJ

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Keep fields when toggling forms (2000/97)

    Hello Erik Jan,

    The macro in your post replaces the original menu command. This means you can't get at the other options in that command any more (protect for remarks and tracked changes).

    Perhaps it would be better to put the code in a standard macro:

    Sub SafeProtect()
    With ActiveDocument
    If .ProtectionType = wdNoProtection Then
    .Protect Type:=wdAllowOnlyFormFields, NoReset:=True
    Else
    .Unprotect
    End If
    End With
    End Sub

    and then drag this macro to the Forms toolbar. You can create a button face (icon) for the new toolbar button, or copy the face of the standard lock/unlock button.

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Keep fields when toggling forms (2000/97)

    If you want a more comprehensive solution, have a look at this item on mvps.org.

Posting Permissions

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