PDA

View Full Version : VBA code



Wei
06-21-2022, 08:45 AM
In my Outlook To Colum, i have some email recipients

My VB code, expect to read the email address , but it read the name.... how can i change the code so it reading the email address correctly?

My VBA code as below:
------------------------

:
On Error Resume Next
Set Recipients = Item.Recipients
For i = Recipients.Count To 1 Step -1
Set recip = Recipients.Item(i)
If (InStr(LCase(recip), "yahoo.com")) > 0 Then
yahoo_Domain_Count = yahoo_Domain_Count + 1
ElseIf (InStr(LCase(recip), "gmail.com")) > 0 Then
gmail_Domain_Count = gmail_Domain_Count + 1
End if
Next i

KSD050
07-31-2022, 07:55 PM
This works:
https://stackoverflow.com/questions/12641704/how-do-you-extract-email-addresses-from-the-to-field-in-outlook