Ceci est une page optimisée pour les mobiles. Cliquez sur ce texte pour afficher la vraie page.

Problème/code envoi mail avec serveur Microsoft Exchange

  • Initiateur de la discussion Initiateur de la discussion zombe
  • Date de début Date de début

Boostez vos compétences Excel avec notre communauté !

Rejoignez Excel Downloads, le rendez-vous des passionnés où l'entraide fait la force. Apprenez, échangez, progressez – et tout ça gratuitement ! 👉 Inscrivez-vous maintenant !

zombe

XLDnaute Occasionnel
Salut le forum

Permettez que je soumette un problème sur le fonctionnement d'un de mes codes que je ne comprend vraiment pas.
le problème a commencé le jour ou nous avons basculé sur Microsoft Exchange.
Je ne sais pas si le code a besoin d'être adapté à ce nouveau serveur.
Je vous laisse l'apprécier pour pouvoir profiter de vos multiples expériences.
Ci-dessous le code:
Code:
Option Explicit
Sub Envoi_Mail()
' Works in Excel 2000, Excel 2002, Excel 2003, Excel 2007, Excel 2010, Outlook 2000, Outlook 2002, Outlook 2003, Outlook 2007, Outlook 2010.
' This example sends the last saved version of the Activeworkbook object .
    Dim OutApp As Object
    Dim OutMail As Object
    Dim texte As String
    Dim i As String
    Dim Nomfic As String, spath As String, Nomfic1 As String, spath1 As String, spath2 As String, nomfic2 As String, spath3 As String, nomfic3 As String
    spath = Environ("USERPROFILE")
    spath1 = Environ("USERPROFILE")
    spath2 = Environ("USERPROFILE")
    spath3 = Environ("USERPROFILE")
    spath = spath & "\bureau\SGIIOC+\"
    spath1 = spath1 & "\bureau\SGIIOC+\"
    spath2 = spath2 & "\bureau\SGIIOC+\"
    spath3 = spath3 & "\bureau\SGIIOC+\"
    Nomfic = Sheets("parametre").Range("A107").Value
    Nomfic1 = Sheets("parametre").Range("A108").Value
    nomfic2 = Sheets("parametre").Range("A109").Value
    nomfic3 = Sheets("parametre").Range("A1010").Value
    
    Set OutApp = CreateObject("Outlook.Application")
    Set OutMail = OutApp.CreateItem(0)
    i = Range("C35").Value
    texte = texte & Sheets("PF").Range("C74").Value & " le, " & Date & vbCrLf & vbCrLf
    texte = texte & "A" & vbCrLf
texte = texte & Sheets("parametre").Range("AO2").Value & vbCrLf
texte = texte & Range("C32").Value & vbCrLf
texte = texte & Sheets("parametre").Range("U98").Value & vbCrLf & vbCrLf & vbCrLf

    On Error Resume Next

    With OutMail
        .To = Range("C35").Value
        .CC = ""
        .BCC = ""
        .Subject = "Bienvenue dans votre Banque"
        .Body = texte
        .Attachments.Add spath & Nomfic
        .Attachments.Add spath1 & Nomfic1
        .Attachments.Add spath2 & nomfic2
        .Attachments.Add spath3 & nomfic3
        
        ' You can add other files by uncommenting the following line.
        '.Attachments.Add ("C:\users/benzoplus/desktop/lm bad.pdf")
        'Ex:.Attachments.Add ("C:\users/benzoplus/desktop/lm bad.pdf")
        ' In place of the following statement, you can use ".Display" to
        ' display the mail.
        .Send
    End With
    On Error GoTo 0

    Set OutMail = Nothing
    Set OutApp = Nothing
    
End Sub
 
- Navigue sans publicité
- Accède à Cléa, notre assistante IA experte Excel... et pas que...
- Profite de fonctionnalités exclusives
Ton soutien permet à Excel Downloads de rester 100% gratuit et de continuer à rassembler les passionnés d'Excel.
Je deviens Supporter XLD

Discussions similaires

  • Question Question
Microsoft 365 Code VBA
Réponses
7
Affichages
868
  • Question Question
Microsoft 365 Question code VBA
Réponses
2
Affichages
488
Réponses
2
Affichages
875
Réponses
3
Affichages
777
Réponses
2
Affichages
978
Réponses
17
Affichages
2 K
Les cookies sont requis pour utiliser ce site. Vous devez les accepter pour continuer à utiliser le site. En savoir plus…