Hack 53 Sidestep Formatting Restrictions![]() ![]() rigidly consistent, but sometimes you gotta break the rules.Word 2003 introduced formatting restrictions as a way to restrict the kinds of formatting users can apply to a document. To activate formatting protection, select Tools Protect Document Task Pane, shown in Figure 6-5, you can specify which types of editing and formatting restrictions to enforce. Figure 6-5. Setting editing and formatting restrictions in a document![]() Protection" button, you can optionally supply a password. As you're about to see, including a password is fairly useless, but it may keep some users from futzing with the formatting.
formatting commands, such as the Bold and Italic buttons on the toolbar, can be used. If you try, you get the message shown in Figure 6-6. Figure 6-6. What you see when you try to format a protected document![]() create a new, blank document and fill in some placeholder text [Hack #14] . From the Protect Document Task Pane, turn on formatting protection. Many of the buttons on the Formatting toolbar will appear grayed out.Select some text in the document and click the Bold button. You'll get the dialog shown in Figure 6-6. Now select Tools following in the Immediate window [Hack #2], and then press Enter: Selection.Font.Bold = TrueGo back to the document and view your formatting changes. From VBA, you can apply any of the "restricted" formatting in the document. 6.4.1 Hacking the HackApplying some formatting with VBA is fine as a quick fix for an unexpectedly protected document, but if you want to remove all the formatting and editing protection from a document, you'll need to hack the document as an RTF file.With your "protected" document open, go back to the Protect Document Task Pane and set the Editing Protection to Read Only. Now select File file as Rich Text Format.Close the file from Word, and then open it in a standard text editor, such as Notepad. Find the following two statements and remove them from the file. \lsdlockeddef1{\lsdlockedexcept Normal;Default Paragraph Font;HTML Top of Form;Save and close the RTF file, and then reopen it in Word. You'll see that the protection is no longer active. The moral of the story? Restriction settings can help you cut down on undesired formatting and editing, but don't rely on them for more than superficial protection. |