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
| Option Explicit
Dim newItem
Sub Nouvelle_Réunion()
Dim sPathUser As String
sPathUser = Environ$("USERPROFILE") & "\Application Data\Microsoft\Outlook\reunion.oft"
Set newItem = Application.CreateItemFromTemplate(sPathUser)
newItem.Display
Set newItem = Nothing
End Sub
Sub Créer_bouton()
'Déclarations des objets
Dim objExplorer As Outlook.Explorer
Dim objCommandBar As Office.CommandBar
Dim objControl As Office.CommandBarButton
'instance des objets
Set objExplorer = Outlook.ActiveExplorer
Set objCommandBar = objExplorer.CommandBars.Item("Menu Bar")
Set objControl = objCommandBar.Controls.Add(, , , , False)
'objet Control
With objControl
.Caption = "Créer une réunion"
.FaceId = 462
.Style = msoButtonIconAndCaption
.Tag = "Nouvelle Réunion"
.OnAction = "Nouvelle_Réunion"
.Visible = True
End With
'libération des instances
Set objExplorer = Nothing
Set objCommandBar = Nothing
Set objControl = Nothing
End Sub |
Partager