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
| Dim WithEvents colSentItems As Items
Private Sub Application_Startup()
Dim NS As Outlook.NameSpace
Set NS = Application.GetNamespace("MAPI")
Set colSentItems = NS.GetDefaultFolder(olFolderSentMail).Items
Set NS = Nothing
End Sub
Private Sub colSentItems_ItemAdd(ByVal Item As Object)
'By Oliv ' janv 2008 pour Outlook 2003 feat. Sue Mosher 'http://www.outlookcode.com/codedetail.aspx?id=456
If Item.Class = olMail Then
Enrg = MsgBox(Item.Subject & vbCr & "Voulez-vous enregistrer ce mail sur le serveur?", vbYesNo)
If Enrg = vbYes Then
Item.Display
Dim objInsp
Dim colCB
Dim objCBB
On Error Resume Next
Set objInsp = Item.GetInspector
Set colCB = objInsp.CommandBars
Set objCBB = colCB.FindControl(, 748) 'enregistrer sous
If Not objCBB Is Nothing Then
objCBB.Execute
End If
ElseIf Enrg = vbNo Then
Item.Close olDiscard
End If
End If
End Sub |
Partager