Bonjour,
Ci-joint le code pour envoyer un mail avec pièce jointe. Une erreur 13 sur le .Attachments.Add. J'ai essayé avec une tempo mais rien a faire. Si quelqu'un a une idée. Merci d'avance
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
42 Dim iMsg As Object, iConf As Object, Flds As Object Set iMsg = CreateObject("cdo.message") Set iConf = CreateObject("cdo.configuration") Set Flds = iConf.fields With Flds .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 'remplacez "smtp.nomserveur.fr" par le nom de serveur de votre FAI : 'http://outlook.developpez.com/faq/index.php?page=Configuration#Paras_FAI .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "10.33.120.40" .Update End With With iMsg Set .Configuration = iConf .To = "xxxxx" .Cc = "xxxxx" .From = "xxxxxx" .Subject = montexte .HTMLBody = "Ceci est un essai ..." .Attachments.Add "C:\Documents and Settings\fred\Pièces_de_rechange.pdf" .Send End With ActiveWorkbook.Close True ComboBox1.ListIndex = -1 ' ActiveSheet.OLEObjects("OptionButton" & k).Object.Value = False UserForm2.Hide End Sub
Partager