本示例检查当前工作簿是否有密码保护,如果有则显示提示信息。
If ActiveWorkbook.HasPassword = True Then
MsgBox "本工作簿中含有密码!"
End If