HasPassword 属性

       

如果指定工作簿有密码保护,则该值为 TrueBoolean 类型,只读。

说明

可用 SaveAs 方法为工作簿指定密码保护。

示例

本示例检查当前工作簿是否有密码保护,如果有则显示一条信息。

If ActiveWorkbook.HasPassword = True Then
    MsgBox "Remember to obtain the workbook password" & Chr(13) & _
        " from the Network Administrator."
End If