Créer une macro template de mail pour chaque classeur

%3CLINGO-SUB%20id%3D%22lingo-sub-1553370%22%20slang%3D%22fr-FR%22%3ECreate%20an%20email%20macro%20template%20for%20each%20binder%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1553370%22%20slang%3D%22fr-FR%22%3E%3CP%3EHello%2C%20%3CBR%20%2F%3E%3CBR%20%2F%3E%20I%20would%20love%20to%20create%20a%20macro%20that%20generates%20an%20email%20template%20specific%20to%20each%20binder%3A%3C%2FP%3E%3CP%3E%22Absent%20Sales%2C%22%20%22Stock%20Absent%2C%22%20%22Data%20Absent%2C%22%20%22Delay%20Sales%2C%22%20...%2C%20%3CBR%20%2F%3E%20etc.%20I%20wish%20I%20could%20have%20in%20the%20Subject%22%20of%20the%20mail%20the%20different%20names%20of%20filing%20cabinets.%20Also%2C%20I%20would%20like%20to%20add%20a%20photo%20at%20the%20beginning%20of%20the%20email%2C%20but%20I%20can't%20figure%20out%20how%20to%20do%20it.%26nbsp%3B%3C%2FP%3E%3CP%3E%3CBR%20%2F%3EAt%20the%20moment%2C%20I%20have%20a%20code%20that%20looks%20like%20this%3A%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22hljs-keyword%22%3EDim%3C%2FSPAN%3E%20%3CSPAN%3E%20outlookObj%20%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-keyword%22%3EAs%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-built_in%22%3EObject%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22hljs-keyword%22%3ESet%3C%2FSPAN%3E%20%3CSPAN%3E%20outlookObj%20-%20CreateObject%3C%2FSPAN%3E%3CSPAN%20class%3D%22hljs-string%22%3E(%22Outlook.Application%22)%3C%2FSPAN%3E%3CSPAN%3E)%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22hljs-keyword%22%3ESet%3C%2FSPAN%3E%20Mail%20-%20outlookObj.CreateItem%3CSPAN%20class%3D%22hljs-number%22%3E(0%3C%2FSPAN%3E)%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22hljs-keyword%22%3EWith%3C%2FSPAN%3E%20Mail.%20SentOnBehalfOfName%20-%20%3CSPAN%20class%3D%22hljs-string%22%3E%22username%40domain.com%22%3C%2FSPAN%3E%20%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E.%20Subject%20-%20Subject%20%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E.%20HTMLBody%20-%20Body%20%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22hljs-keyword%22%3ESet%3C%2FSPAN%3E%20Recipients%20.%20Containers%20%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22hljs-keyword%22%3ESet%3C%2FSPAN%3E%20mailRecipient%20-%20Recipients.Add%20(DstList)%20%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EmailRecipient.Resolve%20%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22hljs-keyword%22%3EEnd%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-keyword%22%3EWith%20Thanks%20in%20advance%20for%20your%20%3CBR%20%2F%3E%3CBR%20%2F%3E%20help%2C%20%3CBR%20%2F%3E%3CBR%20%2F%3E%20Kindly%2C%20%3CBR%20%2F%3E%3CBR%20%2F%3E%20Pierre%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1553370%22%20slang%3D%22fr-FR%22%3E%3CLINGO-LABEL%3EMacros%20and%20VBA%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1553464%22%20slang%3D%22en-US%22%3ERe%3A%20Cr%C3%A9er%20une%20macro%20template%20de%20mail%20pour%20chaque%20classeur%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1553464%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F743710%22%20target%3D%22_blank%22%3E%40Nasmus2807%3C%2FA%3E%26nbsp%3B%20I%20would%20recommend%20you%20check%20out%20this%20youtube.%26nbsp%3B%20I%20think%20he%20did%20a%20real%20nice%20job%20with%20something%20like%20this%3A%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DURF3ikW0Svc%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DURF3ikW0Svc%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1613412%22%20slang%3D%22fr-FR%22%3ERe%3A%20Create%20a%20macro%20template%20mail%20for%20each%20binder%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1613412%22%20slang%3D%22fr-FR%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F570951%22%20target%3D%22_blank%22%3E%40mtarler%3C%2FA%3E%20thank%20you%20very%20much%2C%20it%20helps%20me%20a%20lot!!%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

Bonjour,

J'aimerais beaucoup réaliser une macro qui génère un template de mail spécifique à chaque classeur :

"Ventes Absentes", "Stock Absent", "Data Absent", "Ventes Retard", ..., etc
Je voudrais pouvoir avoir dans l'Objet" du mail les différents noms de classeurs.De plus, je voudrais ajouter au début de mail une photo, mais je n'arrive pas à comprendre comment y parvenir. 


Pour le moment, j'ai un code qui ressemble à ça : 

Dim outlookObj As Object

Set outlookObj = CreateObject("Outlook.Application")

Set Mail = outlookObj.CreateItem(0)

With Mail .SentOnBehalfOfName = "username@domain.com"

.Subject = Subject

.HTMLBody = Body

Set Recipients = .Recipients

Set mailRecipient = Recipients.Add(DstList)

mailRecipient.Resolve

End With

Merci d'avance pour votre aide, 

Cordialement, 

Pierre

2 Replies

@Nasmus2807  I would recommend you check out this youtube.  I think he did a real nice job with something like this:

https://www.youtube.com/watch?v=URF3ikW0Svc

 

In this week's training I will show you how to create Custom Word Documents From Excel without Mail MergeGET 175 OF MY BEST WORKBOOKS ►http://bit.ly/175WKBK...

@mtarler thank you very much, it helps me a lot !!