protection using UserInterfaceOnly

L

Learner

Hello,
I have this code that does not seem to be working in Excel 2003 (it was in
2000):
ActiveSheet.protect UserInterfaceOnly:=True (line 4).
Is there a new equivalence? It was used within a procedure to access the
code via a toolbar.

Sub hideQ1()
Dim cbrCommandBar As CommandBar
Dim cbcCommandBarButton As CommandBarButton
ActiveSheet.protect UserInterfaceOnly:=True
Columns("B:D").Select
Selection.EntireColumn.Hidden = True
Set cbrCommandBar = _
Application.CommandBars("QBR Operating Tool Bar")
If Application.CommandBars("QBR Operating Tool
Bar").Controls.Item(2).Caption _
= " Hide Q1 " Then
With cbrCommandBar.Controls
Set cbcCommandBarButton = cbrCommandBar.Controls.Item(2)
With cbcCommandBarButton
.Style = msoButtonCaption
.Caption = " Show Q1 "
.TooltipText = "Show Quarter 1 / Affiche le 1er trimestre"
.OnAction = "showQ1"
End With
End With
End If
Range("A13").Activate
End Sub

Thank you
 
D

Dave Peterson

I think it was xl2002 that became more stringent with worksheet protection.

Try adding the password in the .protect line:

ActiveSheet.protect Password:="hi there", UserInterfaceOnly:=True
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top