creer taches outlook via excel et publipostage

KELLY

XLDnaute Nouveau
Bonjour,
Je souhaite créer des tâches outlook via un fichier excel. Dans le corps de ma tâche, j’aimerai insérer un tableau avec les données du mon tableau excel, ce qui donnerait ceci :
Capture.JPG
Est-ce possible ? Pouvez-vous m'aider ?
D'avance un grand merci.
Kelly.
 

Pièces jointes

  • Capture.JPG
    Capture.JPG
    72.5 KB · Affichages: 75
  • FICHE .docx
    25 KB · Affichages: 30
  • liste DES dossiers.xlsm
    11.1 KB · Affichages: 34
  • liste DES dossiers.xlsm
    11.1 KB · Affichages: 31

Lone-wolf

XLDnaute Barbatruc
Re : creer taches outlook via excel et publipostage

Bonjour KELLY :)

Pour la création de la tâche c'est ok. Mais pour le tableau, que j'ai préparé sur la feuille 2, tu fais un copier-coller direct; pas moyen de l'inserer par macro. En revanche envoyer un tableau dans un mail c'est tout à fait possible.


Code:
Sub Envois_Tableau()
Dim olApp As Outlook.Application
Dim olMail As MailItem
Dim strHTML As String
Dim myAttachments

Set olApp = CreateObject("Outlook.Application")
Set olMail = olApp.CreateItem(olMailItem)

Windows("Classeur1.xls").Activate
Sheets("Feuil1").Activate
    
strHTML = ""
strHTML = strHTML & "<HEAD>"
strHTML = strHTML & "<BODY>"
strHTML = strHTML & "Bonjour , <BR>vous trouverez ci joint le tableau demandé<BR><BR>"
strHTML = strHTML & "<TABLE BORDER>"
 
myAttachments = ("C:\Users\KELLY\Desktop\Listes des dossiers.xlsm")
 
For i = 1 To 32 'nombre de lignes (exemple plage A1:B5)
 
    strHTML = strHTML & "<TR halign='middle'nowrap>"
    For j = 1 To 9 'nombre de colonnes                                                  'taille du texte 
    strHTML = strHTML & "<TD bgcolor='white'align='center'><FONT COLOR='black'SIZE=4>" _
            & Cells(i, j) & "</FONT></TD>"
    Next j
    strHTML = strHTML & "</TR>"
 
Next i
 
strHTML = strHTML & "</TABLE>"
 
strHTML = strHTML & "<BR><BR>Cordialement<BR>" & Application.UserName
strHTML = strHTML & "</BODY>"
strHTML = strHTML & ""
 With olMail
      .To = ""
      .CC = ""
      .Subject = "Votre Tableau"
      .HTMLBody = strHTML
      .Attachments.Add myAttachments
      .Display
   End With

    Set olMail = Nothing
    Set olApp = Nothing
End Sub
 

Pièces jointes

  • Liste des dossiers.xlsm
    23 KB · Affichages: 62
  • Liste des dossiers.xlsm
    23 KB · Affichages: 43
Dernière édition:

KELLY

XLDnaute Nouveau
Re : creer taches outlook via excel et publipostage

Bonsoir,
Merci de t'être penché sur mon problème !
J'ai en fin de compte fait un publipostage pour ma fiche en enregistrant automatiquement des fichiers individuels.
Puis j'ai modifié ton code en exécutant une tache dans outlook pour chaque dossier en y ajoutant ma PJ.
Merci pour tout !!:)
Kelly
 

Discussions similaires

Statistiques des forums

Discussions
312 321
Messages
2 087 237
Membres
103 497
dernier inscrit
JP9231