Disable Format menu

E

excelent

This code disable Format menu (whole menu)

Application.CommandBars("Format").Enabled = False

But im just vana disable Show (Format/Columns/Show or (hide)

hav do i do that ?

thanks in advance
 
B

Bob Phillips

Application.CommandBars("Worksheet Menu
Bar").Controls("Format").Controls("Column").Controls("Hide").Enabled = False
'True
Application.CommandBars("Worksheet Menu
Bar").Controls("Format").Controls("Column").Controls("Unhide").Enabled =
False 'True


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
E

excelent

Hi bob, i get a Runtime error 5
Invalid procedure call or argument

what is this part ? sheet name or...?
("Worksheet Menu Bar").


"Bob Phillips" skrev:
 
J

Jim Rech

Bob's code might not work on non-English versions of Excel. If that's what
you have try this:

Sub DisableColHideUnhide()
Dim Ctrls As CommandBarControls
Dim Ctrl As CommandBarControl
Set Ctrls = CommandBars.FindControls(, 886)
For Each Ctrl In Ctrls
Ctrl.Enabled = False
Next
Set Ctrls = CommandBars.FindControls(, 887)
For Each Ctrl In Ctrls
Ctrl.Enabled = False
Next
End Sub


--
Jim
| Hi bob, i get a Runtime error 5
| Invalid procedure call or argument
|
| what is this part ? sheet name or...?
| ("Worksheet Menu Bar").
|
|
| "Bob Phillips" skrev:
|
| > Application.CommandBars("Worksheet Menu
| > Bar").Controls("Format").Controls("Column").Controls("Hide").Enabled =
False
| > 'True
| > Application.CommandBars("Worksheet Menu
| > Bar").Controls("Format").Controls("Column").Controls("Unhide").Enabled =
| > False 'True
| >
| >
| > --
| > HTH
| >
| > Bob
| >
| > (there's no email, no snail mail, but somewhere should be gmail in my
addy)
| >
| > | > > This code disable Format menu (whole menu)
| > >
| > > Application.CommandBars("Format").Enabled = False
| > >
| > > But im just vana disable Show (Format/Columns/Show or (hide)
| > >
| > > hav do i do that ?
| > >
| > > thanks in advance
| >
| >
| >
 

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