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
| Sub recherche_Email_dans_body(LeMail As MailItem)
Dim MonOutlook As Outlook.Application
'Dim LeMail As Outlook.MailItem
'Set LeMail = ActiveInspector.CurrentItem
OuCommenceAdresse = InStr(1, LeMail.Body, "mail to : ")
If OuCommenceAdresse > 0 Then
OuEstArobase = InStr(OuCommenceAdresse + 10, LeMail.Body, "@")
OuEstEspace = InStr(OuEstArobase, LeMail.Body, " ")
OuEstparagraphe = InStr(OuEstArobase, LeMail.Body, Chr(10))
OuEstFinParagraphe = InStr(OuEstArobase, LeMail.Body, Chr(13))
OuEstcote = InStr(OuEstArobase, LeMail.Body, """")
Fin = ListMin(OuEstEspace, OuEstparagraphe, OuEstFinParagraphe, OuEstcote)
AdresseEmail = Mid(LeMail.Body, OuCommenceAdresse + 10, Fin - OuCommenceAdresse - 10)
End If
Set LeMail = Nothing
MsgBox "[" & AdresseEmail & "]"
End Sub
Public Function ListMin(ParamArray ListItems() As Variant)
Dim I As Integer
For I = 0 To UBound(ListItems())
If ListMin = "" Then ListMin = ListItems(I)
If ListItems(I) < ListMin Then ListMin = ListItems(I)
Next I
End Function |
Partager