Results 1 to 5 of 5
  1. #1
    3 Star Lounger
    Join Date
    Apr 2004
    Location
    Albuquerque, New Mexico, USA
    Posts
    233
    Thanks
    0
    Thanked 1 Time in 1 Post

    Lock Styles from user edit (Word 2003)

    I'm currently running Word 2002. Let's say I upgrade to Word 2003 to let me lock Styles for a document, via Protect Document. If a Word 2002 or earlier user opens the document, would s/he be able to edit the styles?

  2. #2
    5 Star Lounger
    Join Date
    Dec 2000
    Location
    Tallahassee, Florida, USA
    Posts
    901
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Lock Styles from user edit (Word 2003)

    Unfortunately, yes. I admit I suspected as much but was hoping for a different result. <img src=/S/shrug.gif border=0 alt=shrug width=39 height=15>

    One of my coworkers has 2003. He created a test document and protected all of the document styles. I was able to open in XP and modify the styles in the document whether applied or not.
    Karen

  3. #3
    3 Star Lounger
    Join Date
    Apr 2004
    Location
    Boston, Massachusetts, USA
    Posts
    389
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Lock Styles from user edit (Word 2003)

    Locking styles is a wonderful idea, but it's not (yet) practical. As mentioned, the styles can be edited in a previous version, and within 2003, removing the "lock" from a "protected" document is trivial. And someone wouldn't even need to remove the lock to perform "forbidden" formatting. For example, if you lock a document's formatting, so that the bold button is greyed out (along with other direct-formatting) and only styles can be applied, select some text, switch over to the VBA editor, and type the following in the Immediate window:
    <pre>Selection.Font.Bold = True</pre>

    So much for formatting "protection".

    Better to write validation code that checks for unallowed styles and prompts the user to pick a new one. If I have time to dig it up, I'll post just such a procedure.

  4. #4
    3 Star Lounger
    Join Date
    Apr 2004
    Location
    Albuquerque, New Mexico, USA
    Posts
    233
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Lock Styles from user edit (Word 2003)

    Thanks, Karen, for confirming what I feared.

    Thanks, Andrew. But my users probably think that VBA is some kind of new basketball league (for Vampires? or maybe Vaudeville?), so I don't have to worry about that level of sophistication. But I surely would like a validation code procedure that would lock styles for non-techies. This is a long-term process, so don't feel the need to burn bandwidth on it quickly.

  5. #5
    3 Star Lounger
    Join Date
    Apr 2004
    Location
    Boston, Massachusetts, USA
    Posts
    389
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Lock Styles from user edit (Word 2003)

    Hi Sundog,

    There are a few different ways to approach the problem. The attached is a modified version of some code I use in an authoring template. The attached macro scans each paragraph, and if it finds one that uses a style that's not one of the built-in paragraph styles, it prompts the user to select a replacement from the built-in Styles dialog box. There's some validation code that makes sure they haven't chosen the same style again, or tried to choose a character style to replace the errant paragraph style. Once they've chosen a replacement paragraph style, the macro makes the replacent globally throughout the document, and then continues cheking with the next paragraph.

    If you had some additional custom paragraph styles in your template, you'd want to add another test for that, but I wanted to keep the example as simple as possible. It's really quite short, except for those ugly string concatenations for the user messages.

    Hope this helps!
    Attached Files Attached Files

Posting Permissions

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