Bonjour ,
J'utilise un userform dans excel qui complète un onglet du même fichier.
Ce fichier est ensuite transféré par mail à la personne suivante par VBA
Lorsque la personne suivante ouvre le fichier reçu par mail , elle a un second userform pour compléter sa partie.
Ce processus ce répète avec 5 personnes différentes .
Lors de l’initialisation de la demande par la première personne, celle-ci a la possibilité d'ajouter des pièces jointes en plus dans son mail.
La deuxième personne reçois bien le mail avec les PJ , mais lorsque'elle valide sa partie en l'envoyant (toujours par l'userform) à la troisième personne, je ne sais pas comment reprendre automatiquement les pièces jointes
Sub du Mail:
Sub des pièces jointes
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
41 Private Sub ValiderButonADV_Click() Set ErrorState = New Collection 'Courriel en destination Set AppOutlook = CreateObject("Outlook.application") Set mail = AppOutlook.CreateItem(olMailItem) 'Current User AppOutlook.Session.Logon Set currentUser = AppOutlook.Session.currentUser Sheets("Données").Range("K7") = currentUser.addressEntry.GetExchangeUser.PrimarySmtpAddress CorpsMail1 = "<STYLE> body{Float:Left;Width:200px;height:200px;background-color:#E6EDFB} .titre{Float:left;background-color:#000B72; Color:White;text-align:center } .sous-titre{background-color:#3F68C7;color:White;text-align:center} .main{margin-left:3px;margin-right:3px} th{width: 250px;float:left;background-color:#D2DEFB;} th,td{border-style:ridge;Border-width:thin;border-collapse:collapse;maring-left:3px;word-wrap:break-word;border-color:#CDD9FF; text-align:center;} </STYLE>" & _ "<HTML><BODY><H3 STYLE = ""Color: #00008B;"" >FEC</H3>" & _ "<Table class = ""main"">" & _ "<tr><th> Numéro de FEC </th></table></body></html>" With mail .Subject = "Nouvelle Demande de FEC " .HTMLBody = CorpsMail1 .BodyFormat = olFormatHTML .Recipients.Add (currentUser) .Recipients.Add (Sheets("Données").Range("I7")) For intLastdest = 1 To LastDest.Count .Recipients.Add LastDest(intLastdest) Next intLastdest .VotingOptions = "Valider;Refuser" .Attachments.Add (PJ) .Attachments.Add (PJ2) .Attachments.Add (Fichier2) .Send End With
En vous remerciant
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 Private Sub ImportCDCButton_Click() Dim fd As FileDialog Dim FileChosen As Integer Dim intFile As Integer Set gcolAttachments = New Collection Do CheckImportButtonClicked = True Set fd = Application.FileDialog(msoFileDialogFilePicker) 'the number of the button chosen FileChosen = fd.Show fd.Title = "Choose file to attach" fd.AllowMultiSelect = True fd.InitialFileName = "C:\" fd.InitialView = msoFileDialogViewDetails fd.Filters.Clear fd.Filters.Add "All files", "*.*" fd.FilterIndex = 1 fd.ButtonName = "&OK" If FileChosen <> -1 Then Exit Sub Else For intFile = 1 To fd.SelectedItems.Count gcolAttachments.Add fd.SelectedItems(intFile) Next End If If vbNo = MsgBox("Ajouter d'autres PJ? " & vbLf & vbLf & " More attachments?", vbQuestion + vbYesNo, "Add attachments") Then Exit Sub End If Loop End Sub
Partager