ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   protection using UserInterfaceOnly (https://www.excelbanter.com/excel-programming/376508-protection-using-userinterfaceonly.html)

Learner[_4_]

protection using UserInterfaceOnly
 
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



Dave Peterson

protection using UserInterfaceOnly
 
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



Learner wrote:

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


--

Dave Peterson

Learner[_4_]

protection using UserInterfaceOnly
 
Reposting for an answer.
Thank you
____________
"Learner" wrote in message
...
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






All times are GMT +1. The time now is 10:39 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com