Bonjour,

J'ai besoin de votre aide, j'essaie de me débrouiller en macro mais je suis un peu novice.

J'aimerais envoyer des pièces jointes différentes à des personnes différentes. Pour ce faire j'ai crée une macro mais c'est assez embêtant car selon les mois, je dois envoyer entre 1 et 100 pièces jointes à des personnes différentes et ma macro n'est pas pratique car je dois a chaque fois aller dans la macro et ajouter ou supprimer des informations. Est-ce qu'il est possible de créer un bouton et de noter par exemple 10 et la macro l'envoie à 10 personnes par besoin de bidouiller mon script.

Egalement, j'essaie d'insérer un logo qui est ma signature mais je n'y arrive pas.

Auriez-vous un peu de temps à me consacrer pour solutionner mon problème ?

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
Sub EnvoiPJ()
Dim olApp As Outlook.Application
Dim olMail As MailItem
Dim Ficjoint As String
Set olApp = New Outlook.Application
Set olMail = olApp.CreateItem(olMailItem)
 
derligne = Range("A65535").End(xlUp).Row
For i = 2 To derligne
Set olMail = olApp.CreateItem(olMailItem)
If Range("A" & i).Value <> vide Then
   repA = Range("E" & i).Value
   FicjointA = repA & "\" & Range("F" & i).Value
   repB = Range("G" & i).Value
   FicjointB = repB & "\" & Range("H" & i).Value
   repC = Range("I" & i).Value
   FicjointC = repC & "\" & Range("J" & i).Value
   repD = Range("K" & i).Value
   FicjointD = repD & "\" & Range("L" & i).Value
   repE = Range("M" & i).Value
   FicjointE = repE & "\" & Range("N" & i).Value
   With olMail
       .To = Range("A" & i).Value
       .CC = Range("B" & i).Value
       .Subject = Range("C" & i).Value
       .Body = Range("D" & i).Value
       .Attachments.Add FicjointA
       .Attachments.Add FicjointB
       .Attachments.Add FicjointC
       .Attachments.Add FicjointD
       .Attachments.Add FicjointE
       '.Attachments.Add "c:\My Documents\book.doc"
       .Display '.Send
  End With
' Effacer les variables objets
Set olMail = Nothing
End If
Next i
Set olApp = Nothing
End Sub



Je vous remercie d'avance.

Audrey