LockDocument, LockDocument()

Syntax

LockDocument [Lock]

LockDocument()

Remarks

The LockDocument statement adds or removes read-only protection for an entire master document or one of its subdocuments. If the insertion point is within a master document but not within a subdocument, LockDocument locks or unlocks the entire document. If the insertion point is within a subdocument, LockDocument locks or unlocks the subdocument only.

Argument

Explanation

Lock

Specifies whether to add or remove read-only protection for the subdocument or master document:

0 (zero) Removes read-only protection. Note that if you unlock an entire master document, Word unlocks all subdocuments that were previously locked.

1 Adds read-only protection.

Omitted Toggles read-only protection.


The LockDocument() function returns –1 if the subdocument or master document is read-only and 0 (zero) if it is not. Note that when the insertion point is in a subdocument, LockDocument() returns information about the read-only state of the subdocument only, not of the entire master document.

See Also

ToolsProtectDocument, ToolsProtectSection, ToolsUnprotectDocument