'                                    CDO envoi messagerie directement                                  .
'                 CDO=(Collaboration Data Object) interface accédant à la couche MAPI                  .
Public Sub EnvoiMailCDO(TestEnvoiOk As Boolean) 'TestEnvoiOk pour test enn retour appel
On Error Resume Next
Dim cMail As New CDO.Message
If Err Then 'test si Réfce "Microsoft CDO for..."
   m$ = "CDO n'est pas installé !" & vbLf & _
   "Vous devez cocher(du côté VB) la référence suivante:" & vbLf & _
   "Microsoft CDO for..." & vbLf & _
   "probablement: Microsoft CDO for Windows 2000 Library"
   MsgBox m$, vbCritical, "Erreur référence"
   On Error GoTo 0: Err.Clear
   TestEnvoiOk = False: Exit Sub
End If
Application.ScreenUpdating = False
'envoi direct Email sur messagerie
'init var utiles /création Fichier '<<<
On Error GoTo ErreurMessagerie
With cMail
 .From = EmailAdresExpediteur '<<<
 .To = EmailAdresDestinataire '<<<
 .Subject = EmailSujet '<<<
 .TextBody = EmailMessage '<<<
 .AddAttachment (EmailCheminFichier) '<<<
 .Send
End With
'
On Error GoTo 0: Err.Clear
TestEnvoiOk = True
Application.ScreenUpdating = True
Exit Sub
ErreurMessagerie: 'routine erreur
Msg$ = "Erreur " & Err.Source & "  No " & Err.Number & vbLf & vbLf & Err.Description & vbLf & vbLf & "Vérifiez si vous êtes bien connecté !?"
T$ = "Problème de connexion..."
MsgBox Msg$, vbCritical, T$, Err.HelpFile, Err.HelpContext
On Error GoTo 0: Err.Clear
TestEnvoiOk = False
Application.ScreenUpdating = True
End Sub