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 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
| Dim messagerie As Object
Dim Email As Object
' Dim Flds As Variant
Set messagerie = CreateObject("Outlook.Application")
Set Email = messagerie.CreateItem(0)
Attach = Texte28
With Email
.To = Me.Texte0
.CC = Me.Texte2
.BCC = Me.Texte5
.subject = Me.Texte10
.body = Me.Texte7
Dim liste As String
Dim listetriee() As String
liste = Me.Texte17
listetriee = Split(liste, ",")
For i = LBound(listetriee) To UBound(listetriee)
MsgBox Replace(Replace(Replace(Replace(listetriee(i), "[", ""), "]", ""), "\\", "\"), Chr(34), "")
'MsgBox ("résultat :" & listetriee(i))
'MsgBox Replace(Replace(Replace(listetriee(i), "[", ""), "]", ""), "\\", "\")
.Attachments.Add Replace(Replace(Replace(Replace(listetriee(i), "[", ""), "]", ""), "\\", "\"), Chr(34), "")
Next
'.Attachments.Add (Texte17)
'.Attachments.Add (Texte19)
'.Attachments.Add (Texte20)
'.Attachments.Add (Texte21)
'.Attachments.Add (Texte30)
.Categories = "catégorie violet"
'MsgBox Texte50 tout le chemin et le nom du fichier
'MsgBox Texte45 fichier tout seul
End With
If Me.Texte45 <> "" Then
'Call FilenameInc(Me.Texte50)
If Forms!consultation_dossier!Texte238 = "intranet" Then
Email.SaveAs Me.Texte50
Email.Send
Set Email = Nothing
Set messagerie = Nothing
MsgBox ("Le mail a été envoyé et sauvegardé")
Me.Étiquette130.Visible = True
Texte131 = Texte7
Else
Dim a As String
Dim x As Integer
Dim y As Integer
x = PosDuXieme(Forms!Menu!Texte101, "\", 3)
y = Len(Forms!Menu!Texte101) - x + 1
a = Forms!Menu!Texte85 & "" & Right(Forms!Menu!Texte101, y) & "\" & [Formulaires].[consultation_dossier].[N°dossier_gestion] & " " & [Formulaires].[consultation_dossier].[Pour] & " vs " & [Formulaires].[consultation_dossier].[Contre] & "\" & [Formulaires].[consultation_dossier].[N°dossier_gestion] & " courriers\" & [Texte45] & ".msg"
Email.SaveAs Me.Texte50
Email.Send
Set Email = Nothing
Set messagerie = Nothing
MsgBox ("Le mail a été envoyé et sauvegardé")
Me.Étiquette130.Visible = True
Texte131 = Texte7
End If
Else: MsgBox ("Le mail n'a pas été envoyé car le nom du fichier n'est pas spécifié")
End If |
Partager