Question Count of recipients

Manjeeth Kidiyoor

New member
Local time
Today, 15:08
Joined
Aug 18, 2016
Messages
3
Hi

Thank you so much for sharing Knowledge.

I am working on a project in Microsoft Outlook and Access.

I an email I need to know the count of recipients in TO. ( Excluding CC and BCC).

Below are the codes available to find the total recipients in an email. But I need the total recipients only for TO

Dim itm As Object
x = itm.Recipients.Count

Thank you so much in advance
 
Try this function

Code:
Public Function RecipientsToCount(itm As Outlook.MailItem) As Long

Dim recp As Outlook.Recipient
Dim Count As Long

For Each recp In itm.Recipients
    If recp.Type = olTo Then
        Count = Count + 1
    End If
Next recp
RecipientsToCount = Count

End Function

Note: If you are using this in Access you will need to add the Microsoft Outlook Object reference or convert this to a late binding form. If you convert this to late binding you will find the olTo constant is equal to 1 according to this Web page.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom