John Niezen
John Niezen

Reputation: 11

how to convert powerpoint note text to speech with vba

I want to write a VBA macro that converts the note text to speech using the native windows speech capability.
Anyone done this before?
Any tips how to start and proceed?
In the end I will need to provide different EU languages for conversion.
Thanks John.

Upvotes: 1

Views: 1313

Answers (1)

Jamie Garroch - MVP
Jamie Garroch - MVP

Reputation: 2979

Right, as mentioned above, add a reference in your project to Microsoft Speech Object Library.

Then this function will set you on the right path:

Function SpeakThis(myPhrase As String)
  Dim oSpeaker As New SpeechLib.SpVoice

  ' Set speech properties
  oSpeaker.Volume = 100 ' percent
  oSpeaker.Rate = 1 ' multiplier
  oSpeaker.SynchronousSpeakTimeout = 1
  oSpeaker.AlertBoundary = SVEWordBoundary

  If Not myPhrase = "" Then oSpeaker.Speak myPhrase, SVSFDefault
End Function

Then call this:

SpeakThis "Hello, my name is Jamie and I love VBA!"

Upvotes: 1

Related Questions