[FONT=Fixedsys]Option Explicit[/FONT]
[FONT=Fixedsys][/FONT]
[FONT=Fixedsys]Private Sub Application_NewMailEx(ByVal EntryIDCollection As String)[/FONT]
[FONT=Fixedsys][/FONT]
[FONT=Fixedsys] Dim mailItem As Object
Dim intInitial As Integer
Dim intFinal As Integer
Dim strEntryId As String
Dim intLength As Integer
Dim ireply As VbMsgBoxResult
Dim objExcel As Object
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = False
intInitial = 1
intLength = Len(EntryIDCollection)
intFinal = InStr(intInitial, EntryIDCollection, ",")[/FONT]
[FONT=Fixedsys]
Do While intFinal <> 0
strEntryId = Strings.Mid(EntryIDCollection, intInitial, (intFinal - intInitial))
Set mailItem = Application.Session.GetItemFromID(strEntryId)
ireply = MsgBox("Read email: """ & mailItem.Subject & """? (approx " _
& numwords(mailItem.Body) & " words)", vbYesNo)
If ireply = vbYes Then objExcel.Speech.Speak mailItem.Body
intInitial = intFinal + 1
intFinal = InStr(intInitial, EntryIDCollection, ",")
Loop
strEntryId = Strings.Mid(EntryIDCollection, intInitial, (intLength - intInitial) + 1)
Set mailItem = Application.Session.GetItemFromID(strEntryId)
ireply = MsgBox("Read email: """ & mailItem.Subject & """? (approx " _
& numwords(mailItem.Body) & " words)", vbYesNo)
If ireply = vbYes Then objExcel.Speech.Speak mailItem.Body
objExcel.Quit
Set objExcel = Nothing[/FONT]
[FONT=Fixedsys][/FONT]
[FONT=Fixedsys]End Sub[/FONT]
[FONT=Fixedsys][/FONT]
[FONT=Fixedsys]Function numwords(ByVal argString As String) As Long[/FONT]
[FONT=Fixedsys][/FONT]
[FONT=Fixedsys] Dim sTemp As String
sTemp = argString
Do Until InStr(sTemp, " ") = 0
sTemp = Replace(sTemp, " ", " ")
Loop
numwords = Len(sTemp) - Len(Replace(sTemp, " ", "")) + 1[/FONT]
[FONT=Fixedsys][/FONT]
[FONT=Fixedsys]End Function
[/FONT]