Use Microsoft Speech

Converting text to speech in VBA

 

What can you learn here?

  • Use microsoft SAPI
  • Access from any VBA
  • Office text to speech

Add a reference to the SAPI

SAPI

Create a general procedure to use.


Public Sub say(sTerm As String)
    Dim spv As Object
    Set spv = CreateObject("SAPI.SpVoice")
    spv.Speak sTerm
    Set spv = Nothing
End Sub



Use it

In this case, A tagCloud in Outlook will say the tagCloud, as well as displaying it.
 

With mailItem
        .Subject = tg.tagJob.key
        .BodyFormat = olFormatHTML
        .HTMLBody = tg.htmlResults
        .Display (False)
        say .Body
    End With


Summary

For more tips like this, take a look at Get Started Snippets In the meantime why not join our forum, follow the blog or follow me on twitter to ensure you get updates when they are available. You can also submit anything you want considered for publication on this site to our forum.  See A tagCloud in Outlook for an example of this function.