ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Disable Format menu (https://www.excelbanter.com/excel-programming/416181-disable-format-menu.html)

excelent

Disable Format menu
 
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

Bob Phillips

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


--
HTH

Bob

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

"excelent" wrote in message
...
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




excelent

Disable Format menu
 
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").Contro ls("Hide").Enabled = False
'True
Application.CommandBars("Worksheet Menu
Bar").Controls("Format").Controls("Column").Contro ls("Unhide").Enabled =
False 'True


--
HTH

Bob

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

"excelent" wrote in message
...
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





Jim Rech

Disable Format menu
 
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
"excelent" wrote in message
...
| 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").Contro ls("Hide").Enabled =
False
| 'True
| Application.CommandBars("Worksheet Menu
| Bar").Controls("Format").Controls("Column").Contro ls("Unhide").Enabled =
| False 'True
|
|
| --
| HTH
|
| Bob
|
| (there's no email, no snail mail, but somewhere should be gmail in my
addy)
|
| "excelent" wrote in message
| ...
| 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
|
|
|



excelent

Disable Format menu
 
ok thanks anyway Bob

Jim this work perfect thanks for ur help



"Jim Rech" skrev:

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
"excelent" wrote in message
...
| 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").Contro ls("Hide").Enabled =
False
| 'True
| Application.CommandBars("Worksheet Menu
| Bar").Controls("Format").Controls("Column").Contro ls("Unhide").Enabled =
| False 'True
|
|
| --
| HTH
|
| Bob
|
| (there's no email, no snail mail, but somewhere should be gmail in my
addy)
|
| "excelent" wrote in message
| ...
| 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
|
|
|





All times are GMT +1. The time now is 05:28 PM.

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