我为Excel中的右键上下文菜单创建了一个新项目。但是,当我在表格中右键单击单元格时,它没有出现在右键上下文菜单中。否则,它会出现。我使用的代码(从网上复制)如下:
Sub AddItemToContextMenu()
Dim cmdNew As CommandBarButton
Set cmdNew = CommandBars("cell").Controls.Add
With cmdNew
.Caption = "Copy Occurence Across"
.OnAction = "CopyOccurrence"
.BeginGroup = True
End With
End Sub
有没有什么办法可以让我新添加的项目在单击表格中的单元格时出现?