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 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104
| Sub CreateSF1ListContextMenu()
Const strMenuName As String = "SF1ListMenu"
On Error Resume Next
Dim cbar As CommandBar, Bt As CommandBarButton, Cbx As CommandBarComboBox
CommandBars.Item(strMenuName).Delete
Set cbar = CommandBars.Add(strMenuName, msoBarPopup, , False)
' Delete
Set Bt = cbar.Controls.Add
With Bt
.Caption = "&Delete record"
.OnAction = "=fnDelete()"
.FaceId = 1786
End With
' Preview
Set Bt = cbar.Controls.Add
With Bt
.Caption = "&Preview"
.OnAction = "=fnPaste()"
.FaceId = 1544
End With
' Print
Set Bt = cbar.Controls.Add
With Bt
.Caption = "&Print"
.OnAction = "=fnPrint()"
.FaceId = 2521
End With
' Email
Set Bt = cbar.Controls.Add
With Bt
.Caption = "&Email"
.OnAction = "=fnPrint()"
.FaceId = 24
End With
' Combo time line
Set Cbx = cbar.Controls.Add(Type:=msoControlComboBox, ID:=1)
With Cbx
.AddItem "Jour", 1
.AddItem "Semaine", 2
.AddItem "Mois", 3
.AddItem "Année", 4
.AddItem "Tout", 5
.AddItem "Période", 6
.DropDownLines = 6
.DropDownWidth = 75
.ListIndex = 3
.Caption = "&Voir par"
'.OnAction = "=fnRefresh()"
'.FaceId = 1759
End With
' Combo order by
Set Cbx = cbar.Controls.Add(Type:=msoControlComboBox, ID:=1)
With Cbx
.AddItem "Date", 1
.AddItem "Titre", 2
.AddItem "Auteur", 3
.DropDownLines = 3
.DropDownWidth = 75
.ListIndex = 1
.Caption = "&Trier par"
'.OnAction = "=fnRefresh()"
'.FaceId = 1759
End With
' Refresh
Set Bt = cbar.Controls.Add
With Bt
.Caption = "&Refresh"
.OnAction = "=fnRefresh()"
.FaceId = 1759
End With
' Remove filter
Set Bt = cbar.Controls.Add
With Bt
.Caption = "&Remove filter"
.OnAction = "=fnRefresh()"
.FaceId = 605
End With
' Close
Set Bt = cbar.Controls.Add
With Bt
.Caption = "&Close"
.OnAction = "=fnClose()"
'.FaceId = 605
End With
' Help
Set Bt = cbar.Controls.Add
With Bt
.Caption = "&Aide"
.OnAction = "=fnRefresh()"
.FaceId = 926
End With
End Sub |
Partager