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
| Const MENU_CONTEXT_CAPTION As String = "Intégration Données..."
Dim Integration As Variant 'portée Module
Sub MenuContextuel(Optional dummy As Byte)
Dim BAR As CommandBar
Dim C As CommandBarControl
Dim CB As CommandBarComboBox
Dim i&
'---
Integration = Array("Calame", "E-Tech", "Grand Livre")
Call DeleteMenuContextuel
Set BAR = Application.CommandBars("Ply")
Set C = BAR.Controls.Add(Type:=msoControlPopup, Before:=1, Temporary:=True)
With C
.Caption = MENU_CONTEXT_CAPTION
.Tag = "My_Cell_Control_Tag"
For i& = LBound(Integration) To UBound(Integration)
With .Controls.Add(Type:=msoControlButton)
.Caption = Integration(i&)
.OnAction = "'NomFeuille " & i& & "'"
End With
Next i&
End With
BAR.Controls(2).BeginGroup = True
End Sub
Sub DeleteMenuContextuel(Optional dummy As Byte)
On Error Resume Next
Application.CommandBars("Ply").Controls(MENU_CONTEXT_CAPTION).Delete
End Sub
Sub NomFeuille(Index As Integer)
If Index = 0 Then
Call Calame
ElseIf Index = 1 Then
Call Etech
ElseIf Index = 2 Then
Call x
End If
End Sub |
Partager