Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionOption Explicit Const ForReading 1, ForWriting 2, ForAppending = 8 Dim Source, Destination, MyHex, MyBinary, i Dim oShell, oApp, oFolder, oCTF, oFile Dim oFileSys Dim objMail Source = "C:\Temp" Destination = "C:\maSauvegarde.zip" MyHex = _ Array(80, 75, 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) For i = 0 To UBound(MyHex) MyBinary = MyBinary & Chr(MyHex(i)) Next Set oShell = CreateObject("WScript.Shell") Set oFileSys = CreateObject("Scripting.FileSystemObject") 'Creation du zip Set oCTF = oFileSys.CreateTextFile(Destination, True) oCTF.Write MyBinary oCTF.Close Set oCTF = Nothing Set oApp = CreateObject("Shell.Application") Set oFolder = oApp.NameSpace(Source) If Not oFolder Is Nothing Then _ oApp.NameSpace(Destination).CopyHere oFolder.Items wScript.Sleep 5000 Set oFile = Nothing //Partie mail qui ne foctionne pas Set objMail = CreateObject("CDO.Message") objMail.Subject = "Projet envoi de mail" objMail.Sender = "csauvage@leader.com" objMail.To = "csauvage@leader.com" objMail.TextBody = "Projet envoi de mail" objMail.addattachment "c:\maSauvegarde.zip" 'Nom du serveur SMTP objMail.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "192.168.1.57" objMail.Send