Reputation: 11
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
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