使用excel 2010.我有一个包含多个工作表的工作簿。在一张表(称为" main")中我保护了诸如:菜单栏,公式栏,状态栏,网格线等等。我有一个密码保护的Commandbutton,它应该取消隐藏的东西" 。但是当我点击那个Commandbutton并输入正确的密码时,没有什么可以隐藏的。在VBA我有appr。片:
Private Sub CommandButton5_Click()
Dim pw As String
Dim a As CommandBar
pw = InputBox("Give password")
If pw <> "mypassword" Then
MsgBox "Wrong password"
Exit Sub
Else
With Application
.ScreenUpdating = False
.EnableEvents = False
.DisplayFullScreen = True
With .CommandBars("Worksheet Menu Bar")
.Enabled = True
.Visible = True
End With
.CommandBars("Cell").Enabled = True
.CommandBars("Standard").Visible = True
.CommandBars("Formatting").Visible = True
.DisplayFormulaBar = True
.DisplayStatusBar = True
End With
With ActiveWindow
.DisplayHeadings = True
.DisplayWorkbookTabs = True
.DisplayHorizontalScrollBar = True
.DisplayVerticalScrollBar = True
.DisplayGridlines = True
End With
End If
Application.ScreenUpdating = True
Application.EnableEvents = True
Cells(1, 1).Select
End Sub
所以我的问题是,为什么这不起作用或我怎么能 - 不关闭工作簿 - 取消隐藏隐藏的项目。