View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
quartz[_2_] quartz[_2_] is offline
external usenet poster
 
Posts: 441
Default Items Added to Right-Click Menu Only Visible From Some Sheets

I haven't experienced the issue with named ranges. When I discovered the
various changes in the menu based on the user context, I just modified the
code to alter EVERY right click menu. This works very well, even if the user
right clicks on a row number or column letter (to select the entire row or
column) the custom menu is available.

Hopefully this will work for you...

"Carroll" wrote:

Here is the code:

Private Sub Workbook_Open()
On Error Resume Next
Application.CommandBars("Cell").Controls("1.Import IDA Data").Delete
Application.CommandBars("Cell").Controls("2.Add New Date Row").Delete
Application.CommandBars("Cell").Controls("3.Save Reports").Delete
On Error GoTo 0

With Application.CommandBars("Cell").Controls.Add(tempo rary:=True)
.Caption = "1.Import IDA Data"
.OnAction = ThisWorkbook.Name & "!Import"
.BeginGroup = True
End With
With Application.CommandBars("Cell").Controls.Add(tempo rary:=True)
.Caption = "2.Add New Date Row"
.OnAction = ThisWorkbook.Name & "!AddNewRows"
.BeginGroup = True
End With
With Application.CommandBars("Cell").Controls.Add(tempo rary:=True)
.Caption = "3.Save Reports"
.OnAction = ThisWorkbook.Name & "!SaveReports"
.BeginGroup = True
End With
End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.CommandBars("Cell").Controls("1.Import IDA Data").Delete
Application.CommandBars("Cell").Controls("2.Add New Date Row").Delete
Application.CommandBars("Cell").Controls("3.Save Reports").Delete
End Sub

None of the sheets involve charts or pivot tables. They are all just
normal sheets.
I notice that the right-click menu changes when I'm in a named range.
I have since realized that it's not entire sheets that don't have the
items I added to the right-click menu; it's only when the active cell
happens to fall within a named range. Does that make sense? I'm
thinking now that there is a separate right-click menu for when you are
in named ranges?

Carroll