_Document.Unprotect(Object) 方法

定义

从指定的文档中删除保护。Removes protection from the specified document. 如果对文档没有加以保护,则该方法会导致出错。If the document isn't protected, this method generates an error.

public void Unprotect (ref object Password);
abstract member Unprotect : obj -> unit
Public Sub Unprotect (Optional ByRef Password As Object)

参数

Password
Object

可选对象Optional Object. 用于保护文档的密码字符串。The password string used to protect the document. 密码是区分大小写的。Passwords are case-sensitive. 如果用户在使用一篇设置有密码的文档时没有提供正确的密码,就会显示一个对话框,提示用户输入密码。If the document is protected with a password and the correct password isn't supplied, a dialog box prompts the user for the password.

注解

避免在应用程序中使用硬编码的密码。如果某个过程需要密码,可要求用户提供密码,将其以变量形式进行存储,然后在编码中使用该变量。Avoid using hard-coded passwords in your applications. If a password is required in a procedure, request the password from the user, store it in a variable, and then use the variable in your code.

适用于