how to convert powerpoint note text to speech with vba

我只是一个虾纸丫 提交于 2020-01-25 21:00:28

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!