Results 1 to 7 of 7
  1. #1
    New Lounger
    Join Date
    Dec 2001
    Location
    Jerusalem, Israel
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unwanted shading of unprotected section(Word 2003)

    Hi,

    I have a problem with unwanted shading when protecting a template and documents based on it , and leaving one section unprotected. Can anyone tell me where the shading comes from and how to eliminate it?

    Details:
    I protect a template but leave one section unprotected. From the time protection is first set, the text in the unprotected section is shaded light gray when the document is unprotected and yellow when protected. I have tried to get rid of this unwanted formatting with the shading button of the tools menu, the highlight button, and the various format dialogs.

    When protecting manually, there's a "Highlight the regions I can edit" checkbox. When that's unchecked, the shading is gone, but the result is not persistent: when this is done on the template, it has no effect on documents created from the template.

    In general, I want to protect/unprotect in code. I can't record unchecking "Highlight the regions I can edit" , so I don't know what properties it affects.

    The macros I'm using are:

    Public Sub PDoc(pwd$)
    'Protect document
    With ActiveDocument
    If .ProtectionType = wdNoProtection Then
    .Sections(5).ProtectedForForms = False
    .FormFields.Shaded = False
    .Protect Password:=pwd, NoReset:=False, Type:= _
    wdAllowOnlyReading, UseIRM:=False, EnforceStyleLock:=False
    End If
    End With
    End Sub

    Public Sub UPDoc(pwd$)
    'Unprotect document
    With ActiveDocument
    If .ProtectionType <> wdNoProtection Then
    .Unprotect pwd
    End If
    .Sections(5).ProtectedForForms = False
    .FormFields.Shaded = False

    End With
    End Sub


    I'd appreciate any help.

    Steve

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Unwanted shading of unprotected section(Word 2

    Ever since Task Panes were introduced in Word 2002, the object model available in VBA has provided little to no access to them. In this case, I'm inclined to let the user decide about the shading by displaying the appropriate Task Pane:

    <code>Sub ProtectIt()
    ActiveDocument.Protect Type:=wdAllowOnlyReading, NoReset:=True
    If Not Application.TaskPanes(wdTaskPaneDocumentProtection ).Visible Then
    Application.TaskPanes(wdTaskPaneDocumentProtection ).Visible = True
    End If
    End Sub</code>

    You know your users better than I do, so if this would be more bothersome than helpful to them, then never mind. <img src=/S/blackteeth.gif border=0 alt=blackteeth width=20 height=20>

  3. #3
    4 Star Lounger
    Join Date
    Dec 2003
    Location
    Zoetermeer, Zuid-Holland, Netherlands
    Posts
    559
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Unwanted shading of unprotected section(Word 2003)

    <hr>When protecting manually, there's a "Highlight the regions I can edit" checkbox.<hr>
    Where is this checkbox located? In my Dutch version of Word 2003, there appears to be no such checkbox on the document protection taskpane, which ever option on that pane is selected.

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

    Re: Unwanted shading of unprotected section(Word 2003)

    It is available in the English version if you select No changes (read only) in Editing restrictions. See screenshot.
    Attached Images Attached Images
    • File Type: png x.PNG (8.0 KB, 0 views)

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

    Re: Unwanted shading of unprotected section(Word 2003)

    Try this to clear the check box and hide the shading in VBA:

    ActiveWindow.View.ShadeEditableRanges = False

    (and of course, ... = True to tick the check box and show the shading)

  6. #6
    4 Star Lounger
    Join Date
    Dec 2003
    Location
    Zoetermeer, Zuid-Holland, Netherlands
    Posts
    559
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Unwanted shading of unprotected section(Word 2003)

    Thanks Hans, I found it now. It's only visible after password protection is applied. Contrary to protection for forms where you can choose which sections to (un)protect before password protecting the doc.

  7. #7
    New Lounger
    Join Date
    Dec 2001
    Location
    Jerusalem, Israel
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Unwanted shading of unprotected section(Word 2003)

    Thank you very much.
    Interestingly enough, this works when protecting the document, but has no effect when unprotecting a document. Since I care much more about the users' experience than the maintenance peoples' experience, I don't care very much. It is an oddity, though.

Posting Permissions

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