WD6x: Error: "ToolsProtectDocument Command Is Not Available"Last reviewed: February 3, 1998Article ID: Q120350 |
The information in this article applies to:
SYMPTOMSThe following WordBasic error message may occur when you run a macro that protects a document for forms:
The ToolsProtectDocument command is not available because the document is already protected. CAUSEYou recorded the macro that protects your document. When you record the Protect Document command, Word for the Macintosh creates a macro that contains two ToolsProtectDocument statements. When the second instance of the statement is run, the above error occurs because the document is already protected. In addition, if you continue to record TAB or ENTER keystrokes to move between form fields after you protect the document, Word places an "Unrecognized_Statement336" statement in the macro in place of each keystroke. For example, Word creates the following macro when you turn on the macro recorder, protect the document, press TAB or ENTER three times to move between form fields, and then unprotect the document:
Sub MAIN ToolsProtectDocument .DocumentPassword = "", .NoReset = 0, .Type = 2 ToolsProtectDocument .DocumentPassword = "", .NoReset = 0, .Type = 2 Unrecognized_Statement336 Unrecognized_Statement336 Unrecognized_Statement336 ToolsUnprotectDocument End SubNOTE: This problem does not occur in Word for Windows because Word for Windows stops the macro recorder automatically whenever you record the ToolsProtectDocument statement.
WORKAROUNDWARNING: ANY USE BY YOU OF THE CODE PROVIDED IN THIS ARTICLE IS AT YOUR OWN RISK. Microsoft provides this macro code "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose. Edit the macro to remove the duplicate ToolsProtectDocument command and replace the "Unrecognized_Statement336" statements with the appropriate WordBasic statements. For example, modify the macro to resemble the following:
Sub MAIN ToolsProtectDocument .DocumentPassword = "", .NoReset = 0, .Type = 2 Insert Chr$(9) Insert Chr$(9) Insert Chr$(9) ToolsUnprotectDocument End Sub REFERENCES"Microsoft Word User's Guide," version 6.0 (Macintosh), page 783
|
Additional query words: word basic
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |