问题
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.
回答1:
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!"
来源:https://stackoverflow.com/questions/31154652/how-to-convert-powerpoint-note-text-to-speech-with-vba