Option Explicit
Sub AddToCellMenu()
Dim ContextMenu As CommandBar
Dim MySubMenu As CommandBarControl
' Set ContextMenu to the Cell context menu.
Set ContextMenu = Application.CommandBars("Cell")
' Add one built-in button(Save = 3) to the Cell context menu.
ContextMenu.Controls.Add Type:=msoControlButton, ID:=3, Before:=1
ContextMenu.Controls.Add Type:=msoControlButton, ID:=370, Before:=1
' Add one custom button to the Cell context menu.
With ContextMenu.Controls.Add(Type:=msoControlButton, Before:=1)
.OnAction = "'" & ThisWorkbook.Name & "'!" & "ToggleCaseMacro"
.FaceId = 59
.Caption = "Toggle Case Upper/Lower/Proper"
.Tag = "My_Cell_Control_Tag"
End With
End Sub
Sub ClearMenu()
On Error Resume Next
With Application
.CommandBars("Cell").Controls("Paste Values").Delete
.CommandBars("Cell").Controls("Save").Delete
.CommandBars("Cell").Controls("Toggle Case Upper/Lower/Proper").Delete
End With
On Error GoTo 0
End Sub