Sub showpop(quoi As Variant, boutons)
Dim obj, L#, t#, e&, barre, ActW, opw
Set obj = quoi
opw = Val(Trim(Split(Application.OperatingSystem, "(")(1)))
Set ActW = IIf(opw = 32, ActiveWindow.ActivePane, ActiveWindow)
With ActW
L = .PointsToScreenPixelsX(obj.Left + obj.Width)
t = .PointsToScreenPixelsY(obj.Top)
End With
On Error Resume Next
CommandBars("monmenu").Delete
Err.Clear
Set barre = CommandBars.Add("monmenu", msoBarPopup, False, True)
With barre
For e = 0 To UBound(boutons)
If Not IsArray(boutons(e)) Then
With barre.Controls.Add(msoControlButton, 1, , , True)
.Caption = Split(boutons(e), ":")(0)
.FaceId = Split(boutons(e), ":")(1)
.OnAction = Split(boutons(e), ":")(2)
End With
Else
With barre.Controls.Add(msoControlPopup, 1, , , True)
.Caption = boutons(e)(0)
For i = 1 To UBound(boutons(e))
With .Controls.Add(msoControlButton, 1, , , True)
.Caption = Split(boutons(e)(i), ":")(0)
.FaceId = Split(boutons(e)(i), ":")(1)
.OnAction = Split(boutons(e)(i), ":")(2)
End With
Next
End With
End If
Next
End With
barre.ShowPopup L, t
On Error Resume Next
CommandBars("monmenu").Delete
End Sub