我在Excel单元格上下文菜单中添加了一个宏。
这是主要代码,
Private Sub Workbook_Open()
Dim NewControl As CommandBarControl
Application.CommandBars("Cell").Reset
Set NewControl = Application.CommandBars("Cell").Controls.Add
With NewControl
.Caption = "Inserir Data"
.OnAction = "Module1.OpenCalendario"
.BeginGroup = True
End With
End Sub
在这里你可以看到结果,
无论如何,将这个宏放在菜单的顶部?
答案 0 :(得分:1)
尝试:
Set NewControl = Application.CommandBars("Cell").Controls.Add(before:=1)