Vous utilisez un navigateur obsolète. Il se peut que ce site ou d'autres sites Web ne s'affichent pas correctement. Vous devez le mettre à jour ou utiliser un navigateur alternatif.
OutlookNom des pièces jointes à la fin du courriel
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 !
Public Sub AddAttachmentNamesToBody()
Dim xMailItem As MailItem
Dim xAttachment As Attachment
Dim xFileName As String
Dim xInspector As Outlook.Inspector
Dim xDoc As Word.Document
Dim xWdSelection As Word.Selection
On Error Resume Next
Set xMailItem = Outlook.ActiveInspector.CurrentItem
If xMailItem.Attachments.Count = 0 Then
Exit Sub
End If
xFileName = ""
For Each xAttachment In xMailItem.Attachments
If xFileName = "" Then
xFileName = " <" & xAttachment.FileName & "> "
Else
xFileName = xFileName & vbCrLf & " <" & xAttachment.FileName & "> "
End If
Next xAttachment
Set xInspector = Outlook.Application.ActiveInspector()
Set xDoc = xInspector.WordEditor
Set xWdSelection = xDoc.Application.Selection
xWdSelection.HomeKey Unit:=wdStory
xWdSelection.InsertBefore "Attachments: " & vbCrLf & xFileName & vbCrLf & vbCrLf
Set xMailItem = Nothing
End Sub
et
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim xMailItem As MailItem
If Item.Class = olMail Then
Set xMailItem = Item
If xMailItem.Attachments.Count > 0 Then
AddAttachmentNamesToBody
End If
End If
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