Read Mail

To read mail from Excel, use the ActivateMicrosoftApp method to start Outlook:

    Sub ReadOutlookMail( )
        Application.ActivateMicrosoftApp xlMicrosoftMail
    End Sub

For HTML-based mail systems, use the FollowHyperLink method to open the mail system’s account page:

    Sub ReadGMail( )
        ' Go to GMail.
        ThisWorkbook.FollowHyperlink "http://mail.google.com/"
    End Sub

For other mail clients, use the Shell method to start the client application:

    Sub ReadEudoraMail( )
        Shell "C:\Program Files\Qualcomm\Eudora\Eudora.exe"
    End Sub

Get Programming Excel with VBA and .NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.