[AccessD] Office 2013 woes - X-Posted

Heenan, Lambert Lambert.Heenan at aig.com
Thu Apr 7 10:43:03 CDT 2016


I have this simple function which uses Outlook automation to verify if an Exchange Server style email address ("LastName, FirstName") is valid or not, which has been running happily since Access 97 days.

The function takes a semicolon delimited list of email addresses and checks if each of them is valid.

Internet addresses of the form somename at somedomain.com<mailto:somename at somedomain.com> are always accepted, and Exchange Server addresses are checked to see if they exist on the Exchange Server.

Here is the code...

<code starts>
Function VerifyEmailAddress(CM_Email) As Boolean
    Dim objOutlook As Outlook.Application
    Dim objOutlookMsg As Outlook.MailItem
    Dim objOutlookRecip As Outlook.Recipient

        ' Create the Outlook session.
        Set objOutlook = CreateObject("Outlook.Application")
        Set objOutlookMsg = objOutlook.CreateItem(olMailItem)

        With objOutlookMsg
            ' Add the To recipient(s) to the message.
            Set objOutlookRecip = .Recipients.Add(CM_Email)
            ' Resolve each Recipient's name.
            For Each objOutlookRecip In .Recipients
                If Not objOutlookRecip.Resolve = True Then ' <--- here is where the test happens
                    objOutlookRecip.Delete
                    VerifyEmailAddress = False
                        Exit For
                Else
                    VerifyEmailAddress = True
                End If
            Next
        End With
        Set objOutlookRecip = Nothing
        Set objOutlookMsg = Nothing
        Set objOutlook = Nothing
End Function
</code ends>

As I said, this has been working fine since Access 97 days It also works in Office 2000, Office XP, Office 2007 and Office 2010. But now I have a user with Office 2013 and it simply fails to recognise any Exchange Server addresses, including distribution lists which are in the Global Address Book.

Anyone have an idea why?

Lambert


More information about the AccessD mailing list