Bonjours tous le monde j'ai une erreur dans mon code mais je ne voit pas pourquoi ça me met Erreur 1004 et me souligne cette ligne : .To = Range(client_Email).Value
merci d'avance de votre aides
Voila mon bout de code :
Sub btn_mail_Click()
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
ActiveWorkbook.Path & "\" & "Devis-" & USF_client.txt_nomclient.Value & ".PDF"
Dim mMessage As Object
Dim mConfig As Object
Dim mChps
SMTPSERVER = "smtp.gmail.com"
SMTPPORT = 25
USER = "***"
PWD = "***"
Set mConfig = CreateObject("CDO.Configuration")
mConfig.Load -1
Set mChps = mConfig.Fields
With mChps
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = SMTPSERVER
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = SMTPPORT
.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = "1"
.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = USER
.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = PWD
.Update
End With
Set mMessage = CreateObject("CDO.Message")
With mMessage
Set .Configuration = mConfig
.From = USER
.To = Range(client_Email).Value
.Subject = "Devis planche"
.TextBody = "Bonjour"
.AddAttachment ActiveWorkbook.Path & "\" & "Devis-" & USF_client.txt_nomclient.Value & ".PDF"
.Send
End With
Set mMessage = Nothing
'Libère les ressources
Set mConfig = Nothing
Set mChps = Nothing
USF_pmi.Hide
End Sub