View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Peter Rooney Peter Rooney is offline
external usenet poster
 
Posts: 325
Default Shortcut menu help

Tom,

It just goes in a normal module?

Regards

Pete



"Tom Ogilvy" wrote:

The code ran fine for me. However, if you run it twice. you may want to put
in

Sub AAAShortCutMenu()
Dim InsDelMenu As CommandBar

On Error Resume Next
Application.CommandBars("Edit Menu").Delete
Set InsDelMenu = CommandBars.Add(Name:="Edit Menu",
Position:=msoBarPopup, Temporary:=True)
With InsDelMenu.Controls.Add(Type:=msoControlButton)
.Caption = "Insert Rows"
.OnAction = "InsertRows"
End With
End Sub


--
Regards,
Tom Ogilvy


"Peter Rooney" wrote in message
...
Good afternoon, Chip!

I stumbled onto this whilst looking for a way to disable all ShortCut

menus
(any advice gratefully appreciated!)

I tried to modify the example to the following, but it doesn't want to

work.
I get "Invalid procedure Call or Argument on the SET line.

Any ideas?

Thanks & have a good weekend

Pete

Sub AAAShortCutMenu()
Dim InsDelMenu As CommandBar
Set InsDelMenu = CommandBars.Add(Name:="Edit Menu",
Position:=msoBarPopup, Temporary:=True)
With InsDelMenu.Controls.Add(Type:=msoControlButton)
.Caption = "Insert Rows"
.OnAction = "InsertRows"
End With
End Sub
--------------------------------------------------------------------------

---------------------
"Chip Pearson" wrote:

Art,

Your code looks good to me. Try changing
.OnAction = "mInsertRows"
' to
.OnAction = "'" & ThisWorkbook.Name & "'!mInsertRows"


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"Art" wrote in message
...
Hi,

I've got a worksheet protected but I'd like my users to be able
to add or
delete rows. I thought I could add a shortcut menu - but it's
not working.

I'm using the following:

-----------------------------------
Set mInsertAndDeleteMenu = CommandBars.Add( _
Name:="Edit Menu", Position:=msoBarPopup, _
Temporary:=True)

With mInsertAndDeleteMenu.Controls.Add(Type:=msoControl Button)
.Caption = "Insert Rows"
.OnAction = "mInsertRows"
End With
-----------------------------------

The menu appears, but mInsertRows does not run. What am I
doing wrong? Or
is there a better way to accomplish this?


Art