nioxys
nioxys

Reputation: 29

Excel Cell Context Menu - Macro

I added a macro to the Excel Cell Context Menu.

This is the main code,

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

Here you can see the result,

Excel Cell Context Menu

Ih there anyway to put this macro on the top of the menu?

Upvotes: 0

Views: 138

Answers (1)

MacroMarc
MacroMarc

Reputation: 3324

Try:

Set NewControl = Application.CommandBars("Cell").Controls.Add(before:=1)

Upvotes: 1

Related Questions