wilson4
08-15-2017, 11:29 PM
Hi All,
I am new with outlook vba, not sure if anyone can help about how to strip [Externals Source] in email subject and strip all received one. I received a lot of duplication in email and sometimes confused.
I checked in the website there is solution but I am not sure how to write in OUTLOOK VBA. Anyone can guide me much appreciated.
Thank you
Regards,
Wilson
Private Sub olkApp_NewMailEx(ByVal EntryIDCollection As String) Dim arrEID As Variant, varEID As Variant, olkItm As Object
arrEID = Split(EntryIDCollection, ",")
For Each varEID In arrEID
Set olkItm = Outlook.Session.GetItemFromID(varEID)
If olkItm.Class = olMail Then
Select Case Left(olkItm.Subject, 4)
Case "FW: ", "RE: "
olkItm.Subject = Mid(olkItm.Subject, 5)
olkItm.Save
End Select
End If
olkItm.Subject = Replace(olkItm.Subject, "[EXTERNAL]", "")
olkItm.Save
Next
Set olkItm = Nothing
End Sub
I am new with outlook vba, not sure if anyone can help about how to strip [Externals Source] in email subject and strip all received one. I received a lot of duplication in email and sometimes confused.
I checked in the website there is solution but I am not sure how to write in OUTLOOK VBA. Anyone can guide me much appreciated.
Thank you
Regards,
Wilson
Private Sub olkApp_NewMailEx(ByVal EntryIDCollection As String) Dim arrEID As Variant, varEID As Variant, olkItm As Object
arrEID = Split(EntryIDCollection, ",")
For Each varEID In arrEID
Set olkItm = Outlook.Session.GetItemFromID(varEID)
If olkItm.Class = olMail Then
Select Case Left(olkItm.Subject, 4)
Case "FW: ", "RE: "
olkItm.Subject = Mid(olkItm.Subject, 5)
olkItm.Save
End Select
End If
olkItm.Subject = Replace(olkItm.Subject, "[EXTERNAL]", "")
olkItm.Save
Next
Set olkItm = Nothing
End Sub