本示例首先将“kingsoft”设置为活动文档的密码,然后显示确认信息。

ActiveDocument.Password = "kingsoft"
If ActiveDocument.HasPassword = True Then
    MsgBox "密码设置完成。"
End If