protect toolbar?

N

Nick B

Probably not understanding something simple, but can you lock a toolbar so
that it cannot be resized? I tried the code below but it had no effect. If I
changed .Protection to equal msoBarNoMove, it indeed kept me from moving the
bar, but I just don't want users to be able to resize it.

Thanks!

I tried:
Sub CustomToolbar()
Dim myBar As CommandBar
Dim myCtrl1 As CommandBarControl, myCtrl2 As CommandBarControl
Set myBar = CommandBars.Add(Name:="My Command Bar", Position:=msoBarTop,
Temporary:=True)
With myBar
Set myCtrl1 = .Controls.Add(Type:=msoControlButton,
ID:=CommandBars("Standard").Controls("Print").ID)
Set myCtrl2 = .Controls.Add(Type:=msoControlButton,
ID:=CommandBars("Standard").Controls("Save").ID)
.Visible = True
.Protection = msoBarNoChangeVisible + msoBarNoCustomize +
msoBarNoResize
End With
End Sub
 
T

Tony Jollans

It works for me.

You don't have any redefinitions of mso contants anywhere do you? Try using
2 instead of msoBarNoResize.
 

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