Code to enable "copy" in commandbarcontrol

J

Jonsson

Hi,

I have found this code from the forum.

It works alright, but I would like to ad the command "copy" as enabled
So that the only commands are "copy" and "paste values"(ID370) i
commandbarcontrol.

Sub Test_Cell_Menu()
Dim Ctl As CommandBarControl
For Each Ctl In CommandBars("Cell").Controls
Ctl.Enabled = False
Next Ctl
Application.CommandBars("cell").Controls. _
Add Type:=msoControlButton, ID:=370, before:=1
End Sub

Any help is apprecciated

//Thoma
 
R

Ron de Bruin

Try this

Sub Test_Cell_Menu()
Dim Ctl As CommandBarControl
For Each Ctl In CommandBars("Cell").Controls
If Ctl.ID <> 19 Then
Ctl.Enabled = False
End If
Next Ctl
Application.CommandBars("cell").Controls. _
Add Type:=msoControlButton, ID:=370, before:=1
End Sub
 

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