Utilisation outlook avec fichier Excel

Bonjour,

Je dois envoyer un emailing sur outlook (avec pièce jointe) en utilisant les adresse mail à partir d'un fichier EXCEL.

Après quelques essais peu concluants, je me demandai si je pouvais bénéficier des conseils éclairés des adeptes de ce forum.

D'avance merci.

Lilou
Configuration: Windows XP Internet Explorer 7.0

1 réponse

  • Votes
  • Date
  • Date décroissante
  1. Bonsoir,

    voici un exemple de code avec pièce jointe d'un nouveau mail du classeur excel converti en pdf
    Sub Macro5()

    ActiveWorkbook.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
    "xxxx" _
    , Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
    :=False, OpenAfterPublish:=False
    On Error Resume Next
    Dim OutlookApp As New Outlook.Application
    Dim Mess As Outlook.MailItem, Desti As String
    Dim PJ As String, fich As String
    Const Chemin = "xxxx"
    Desti = ""
    Set OutlookApp = Outlook.Application
    Set Mess = OutlookApp.CreateItem(olMailItem)
    With Mess
    .Display
    fich = Dir(Chemin & "xxxx")
    Do While fich <> ""
    .Attachments.Add Chemin & fich
    fich = Dir
    Loop
    .Subject = ""
    .HTMLBody = "" + .HTMLBody
    .Recipients.Add Desti
    End With
    End Sub