本文介绍了Worksheet.Unprotect问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我尝试用不正确的密码取消保护工作表时,Excel会打开自己的Worksheet Unprotect对话框。如何抑制对话框,并知道workheet.UnProtect()是否已成功?
When I try to unprotect the worksheet with incorrect password the Excel brings up its own Worksheet Unprotect dialog . How can i suppress dialog and know if the worksheet.UnProtect() succedded or not?
我正在使用Excel 2007版本并且确实对这个版本感到震惊。
I am using Excel 2007 version and really struck on this one.
问候,
Devinder
推荐答案
Public Sub Example()
Dim bAlerts As Boolean
bAlerts = Application.DisplayAlerts
If Not Application.DisplayAlerts = False Then Application.DisplayAlerts = False
' Do your work here in this case unprotecting your sheet
If Not Application.DisplayAlerts = bAlerts Then Application.DisplayAlerts = bAlerts
End Sub
这篇关于Worksheet.Unprotect问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!