65.9K
CodeProject is changing. Read more.
Home

Automatically Readloud Sender and Email Subject in OUTLOOK

starIconstarIconstarIconstarIconstarIcon

5.00/5 (3 votes)

Jan 17, 2015

CPOL
viewsIcon

11253

Read Loud Email Sender and Subject as soon as you received an email in OUTLOOK

Introduction

Have you ever wondered, whether outlooks has a feature to read loud new emails ? It is challenging becuase Text to Speach intergation in outlook is not  that flexibile, however it can be achived by utilizing Microsoft Excel applicaiton object.

Yes it is possible by creating a simple macro to invoke excel text to speach integraion & assosiating it with a Rule as follows.

Using the code

Open Outllook email client and press "Alt +F11" which loads VBA editor. Please create a read loud method as follows.

Public Sub AnnounceMail(Item As Outlook.MailItem)

    Dim xlApp As Object
 
    Dim strFrom As String
    Dim strMessageType As String
    Dim ReadOutText As String
    
    Set xlApp = CreateObject("Excel.Application")
    
    strFrom = Split(Item.Sender, " ")(0)
    strMessageType = Right(Item.Subject, 3)
            
     ReadOutText = "Master,"
     
Select Case strMessageType
    Case "RE:"
        ReadOutText = ReadOutText & strFrom & " replied to an email regarding, " & Item.ConversationTopic
    Case "FW:"
       ReadOutText = ReadOutText & strFrom & " Forwarded an email regarding, " & Item.ConversationTopic
    Case Else
      ReadOutText = ReadOutText & "You have an email from " & strFrom & " regarding, " & Item.ConversationTopic
End Select
    
     ReadOutText = ReadOutText & "."
     
    xlApp.Speech.Speak ReadOutText
    xlApp.Quit
    
    Set xlApp = Nothing

End Sub

Points of Interest

Set xlApp = CreateObject("Excel.Application")

The Annouse mail mehod will utlise Excel to access Text to Speach Engine.

xlApp.Speech.Speak ReadOutText

This code will invoke windows speach engine!

Step 2 :

The next step will be to create a Outlook email rule as below and assosaite with AccountMail method.

Rule should run for Message arrives on this computer.

 

 

Done! Outlook will start read lould all your new mails.