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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
| Public Sub CREATE_POPUPMENU_Tri() 'Menu contextuel Tri
'on déclare nos variables
Dim mCmdBar As CommandBar
Dim mBtn As CommandBarButton
'DoCmd.SetWarnings False
'suppression du Menu existant
'il faut toujours supprimer le menu avant de le re-créer
On Error Resume Next
Application.CommandBars("Tri").Delete
'génération du menu contextuel
'on ajoute notre menu contextuel en lui précisant le type d’affichage de barre souhaité
Set mCmdBar = Application.CommandBars.Add("Tri", msoBarPopup)
'on ajoute les boutons à notre menu contextuel
With mCmdBar
.Controls.Add msoControlButton, 21, , , True '.BeginGroup = True 'Cut
.Controls.Add msoControlButton, 19, , , True 'Copy
.Controls.Add msoControlButton, 22, , , True 'Paste
.Controls.Add msoControlButton, 4016, , , True '.BeginGroup = True 'Sort Ascending
.Controls.Add msoControlButton, 4017, , , True 'Sort Decending
.Controls.Add msoControlButton, 640, , , True '.BeginGroup = True 'Filter By Selection
.Controls.Add msoControlButton, 605, , , True 'Remove Filter/Sort
.Controls.Add msoControlButton, 3017, , , True 'Filter Excluding Selection
.Controls.Add msoControlButton, 10068, , , True 'Filter equals xx
.Controls.Add msoControlButton, 10071, , , True 'Filter not equal to xx
.Controls.Add msoControlButton, 10076, , , True 'Filter contains xx
.Controls.Add msoControlButton, 10089, , , True 'Filter does not contains xx
.Controls.Add msoControlButton, 141, , , True 'Find in form
.Controls.Add msoControlButton, 31581, , , True 'Text filters ------> le sous menu qui reste vide
.Controls.Add msoControlButton, 10077, , , True 'Filter equals xx
.Controls.Add msoControlButton, 10078, , , True 'Filter not equal to xx
.Controls.Add msoControlButton, 10079, , , True 'Filter beings with xx
.Controls.Add msoControlButton, 12696, , , True 'Filter does not beings with xx
.Controls.Add msoControlButton, 10080, , , True 'Filter contains xx
.Controls.Add msoControlButton, 10081, , , True 'Filter does not contains xx
.Controls.Add msoControlButton, 10082, , , True 'Filter ends with xx
.Controls.Add msoControlButton, 10083, , , True 'Filter ends with xx
.Controls.Add msoControlButton, 12697, , , True 'Filter does not ends with xx
.Controls.Add msoControlButton, 10062, , , True 'Filter between
.Controls.Add msoControlButton, 12698, , , True 'Filter before xx
.Controls.Add msoControlButton, 25, , , True '.BeginGroup = True 'Report Zoom
.Controls.Add msoControlButton, 4, , , True 'Report Print
End With
End Sub |
Partager