Microsoft 365 Insertion commentaires avant copie lors d'un envoi via Outlook

riddick93

XLDnaute Nouveau
Bonjour,
Mon titre est pas très parlant mais je ne voulais pas faire de titre à rallonge.
Voici mon problème:
J'ai un code VBA afin d'envoyer via Outlook des informations de mon classeur.
Dans le corps du message j'y insère des graphiques et je souhaiterais mettre avant ces graphique un champ "Commentaires:" en rouge.
J'arrive à mettre le commentaires après la copie mais avant je ne trouve pas!!!!
S'il vous faut le fichier dites le moi et je le mettrais.
Merci d'avance pour vos solutions
Voici mon code:
VB:
Sub mailsend()

'Configuration des variables
Dim OL As Object, mail As Object, wDoc As Object, rng As Object
Dim title As String
Dim filedate As String

Set OL = CreateObject("Outlook.Application")
Set mail = OL.CreateItem(olMailItem)
Set wDoc = mail.GetInspector.WordEditor

'Configuration du mail

title = "Indicateurs Quotidiens"
filedate = ThisWorkbook.Sheets("CONFIG").Range("C2")
   
   Sheets("RAPPORT").Activate
   
    With mail
        .To = Sheets("CONFIG").Range("$C$12").SpecialCells(xlCellTypeVisible).Value
        '.To = "alaide@svp.com"
        .CC = Sheets("CONFIG").Range("$C$15").SpecialCells(xlCellTypeVisible).Value
        .BCC = Sheets("CONFIG").Range("$C$18").SpecialCells(xlCellTypeVisible).Value
        .Subject = title & filedate
        .BodyFormat = olFormatHTML
        .Display
       
        Range("A3:N14").Copy
        Set rng = wDoc.Content
        rng.Paste
   
        ' Insertion texte premier tableau
        rng.InsertAfter "" & vbNewLine & "Commentaires" & vbCrLf
       
        .Display
    End With
   
    Set OL = Nothing
    Set mail = Nothing
    Set wDoc = Nothing

End Sub
 
Dernière édition:

Discussions similaires

Réponses
2
Affichages
110

Statistiques des forums

Discussions
312 103
Messages
2 085 310
Membres
102 859
dernier inscrit
Diallokass