Results 1 to 9 of 9
  1. #1
    2 Star Lounger
    Join Date
    Dec 2007
    Posts
    179
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Word 2007: Protecting forms disables many ribbon parts and headers + footer

    HI all,

    Word 2007:

    I enable form protection to enable the user to properly enter data into forms.

    When I enable form protection this disables many parts of the ribbon, e.g., complete tabs. It also prevents access to edit the headers + footers.

    I can see the logic in such blocking, however I do not want this. I have a document that includes a form just as part of the document, so I want to leave all other options open.

    Is there a way I can get my cake and eat it - either through a user function or a VBA function?

    TIA

    avraham

  2. #2
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,055
    Thanks
    2
    Thanked 417 Times in 346 Posts
    Hi avraham,

    You might be able to achieve the desired result by using Word 2007's Content Controls. These provide far more flexibility than formfields and don't require forms protection.
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  3. #3
    2 Star Lounger
    Join Date
    Dec 2007
    Posts
    179
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Thanks for the response.

    I need macro control.
    Content controls don't seem to offer me macro event handlers, e.g., when I enter the field and when I leave the field.

    Do they offer macro event handlers?

    -avraham

  4. #4
    2 Star Lounger
    Join Date
    Dec 2007
    Posts
    179
    Thanks
    3
    Thanked 0 Times in 0 Posts
    can you get the names and values of Content controls to appear in the Document Custom Properties dlg box?

    TIA

    -avraham

  5. #5
    Silver Lounger Charles Kenyon's Avatar
    Join Date
    Jan 2001
    Location
    Sun Prairie, Wisconsin, Wisconsin, USA
    Posts
    2,049
    Thanks
    124
    Thanked 119 Times in 116 Posts
    It depends on what you want. Legacy form fields let you trigger macros on exit; not sure about the new ones. What do you want to do in headers and footers that you can't do with ref and styleref fields? See http://addbalance.com/usersguide/fields.htm.

    You can protect only a part of a document but I don't know that doing this will allow the freedom you want.
    Charles Kyle Kenyon
    Madison, Wisconsin

  6. #6
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,055
    Thanks
    2
    Thanked 417 Times in 346 Posts
    Hi avraham,
    Quote Originally Posted by amakeler View Post
    Content controls don't seem to offer me macro event handlers, e.g., when I enter the field and when I leave the field.

    Do they offer macro event handlers?
    You can use the 'This Document' module's 'ContentControlOnEnter' and 'ContentControlOnExit' events. There are other Content Control events there you might also be interested in.

    As for Charles' suggestion of protecting only part of the document, that might achieve what you're after, but it still leaves numerous menu/toolbar/ribbon items inacessible for the whole document.
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  7. #7
    2 Star Lounger
    Join Date
    Dec 2007
    Posts
    179
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Hi Charles,

    Thanks for the response.

    >> You can protect only a part of a document but I don't know that doing this will allow the freedom you want.

    We did protect only a part of the document - only the area with the table in which I put the form controls - but when I activated the protection, Word disabled the headers/footers and many parts of Word ribbon.

    So why does my client want to access the headers/footers and many parts of Word ribbon...? That's what she wants. Who I am to argue?

    Thanks,
    avraham



    Quote Originally Posted by Charles Kenyon View Post
    It depends on what you want. Legacy form fields let you trigger macros on exit; not sure about the new ones. What do you want to do in headers and footers that you can't do with ref and styleref fields? See http://addbalance.com/usersguide/fields.htm.

    You can protect only a part of a document but I don't know that doing this will allow the freedom you want.

  8. #8
    2 Star Lounger
    Join Date
    Dec 2007
    Posts
    179
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Hi Paul,

    Thanks for the response,

    >> As for Charles' suggestion of protecting only part of the document, that might achieve what you're after, but it still leaves numerous menu/toolbar/ribbon items inacessible for the whole document.

    Right.

    Why on earth did MS enforce that? They could have at least given you the option of disabling that limitation feature. Maybe they did...?

    >> You can use the 'This Document' module's 'ContentControlOnEnter' and 'ContentControlOnExit' events. There are other Content Control events there you might also be interested in

    Good to know. Are these events available in regular VBA - i.e., not Visual Studio Office tools ?
    When I tried out content controls, I entered Design mode, and right-clicked to bring up the Properties box. But in the Properties box, I found there was no way of assigning Entry and Exit events. How do you assign Entry and Exit events?

    Thanks,
    avraham

  9. #9
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts
    This thread may be a done deal, but wanted to follow up with some info in case it's useful to others:

    Paul suggested using Content Control events - you can access these from the document's ThisDocument module in the regular VB Editor. Select 'Document' in the object dropdown above the code pane, and you'll then see the event procedures that are available, in the dropdown to the right of that.

    Unlike with legacy formfields, where you could assign a specific OnExit macro to each specific formfield if you wished, a 'ContentControlOnExit' event will fire every time you exit any/all content controls - so if you wanted the code to run only for a specific control, you'd need to add a tag to the content control in its properties, and then test for that tag in the code, like this:
    Code:
    Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)
           If ContentControl.Tag = "cc1" Then
                 MsgBox "Event fired!"
           End If
    End Sub
    The event will also fire while working in 'development mode', so you'd also want to add some code to keep the event from firing while for instance, you were working in a template proper.

    As far as why MS enforced disabling formatting features while working in a protected form, the logic is pretty simple, and has been the same across many versions of Word: the protected form feature is intended for producing and working with well, protected forms, that are not meant to be changeable by the user. Think for example of an online form from a government agency (for example a PDF form) that you are meant to be able to download, fill-in, print etc: that form will always be protected against alteration by the user (other than filling in the fields) - because the layout and fixed content of the form itself should never be changed. It's the same concept with a Word protected form.

    Gary

Posting Permissions

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