Ajouter un sous menu au cell context menu
Bonjour
Débutant, je suis en train de faire un petit plugin VB.net pour microsoft Excel
J'aimerais modifier le Cell context menu afin d'acceder à mes fonctions à partir du clic droit.
J'ai réussi à faire ca grace au lien ci dessous
https://social.msdn.microsoft.com/Fo...for?forum=vsto
EN revanche, j'aimerais grouper mes fonctions dans un sous menu et là je bloque
J'arrive à créer le sous menu mais je n'arrive pas à inclure mes fonctions dedans
Voici mon morceau de code
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| Private WithEvents buttonVL03N As CommandBarButton
Private WithEvents buttonIW53 As CommandBarButton
Private Sub ThisAddIn_Startup() Handles Me.Startup
Dim rcCellContextMenu As CommandBar = Globals.ThisAddIn.Application.CommandBars("Cell")
Dim myMenu As CommandBarPopup
myMenu = TryCast(rcCellContextMenu.Controls.Add(MsoControlType.msoControlPopup, Before:=3), CommandBarPopup)
myMenu.Caption = "SAP Transactions"
myMenu.Tag = "SAP shortcuts "
buttonVL03N = TryCast(rcCellContextMenu.Controls.Add(MsoControlType.msoControlButton, Id:=1, Before:=3, Temporary:=True), CommandBarButton)
buttonIW53 = TryCast(rcCellContextMenu.Controls.Add(MsoControlType.msoControlButton, Id:=1, Before:=4, Temporary:=True), CommandBarButton)
If buttonVL03N IsNot Nothing Then
buttonVL03N.Caption = "VL03N"
buttonVL03N.BeginGroup = False
buttonVL03N.Tag = "Run VL03N"
buttonVL03N.Enabled = True
End If
If buttonIW53 IsNot Nothing Then
With buttonIW53
.Caption = "IW53"
.BeginGroup = False
.Tag = "Run IW53"
.Enabled = True
End With
End If
End Sub |
Il crée un sous menu "SAP" mais les boutons IW53 et VL03N donc directement dans le menu et pas le sous menu. J'ai essayé plusieurs choses mais rien à y faire je ne trouve pas.
Merci de votre aide