如何使用vba将powerpoint便笺文本转换为语音

如何使用vba将powerpoint便笺文本转换为语音,vba,powerpoint,text-to-speech,Vba,Powerpoint,Text To Speech,我想编写一个VBA宏,使用本机windows语音功能将注释文本转换为语音 以前有人这样做过吗 有关于如何开始和继续的提示吗 最后,我将需要提供不同的欧盟语言进行转换 谢谢John。好的,如上所述,在项目中添加对Microsoft Speech Object Library的引用 然后,此函数将为您设置正确的路径: Function SpeakThis(myPhrase As String) Dim oSpeaker As New SpeechLib.SpVoice ' Set spee

我想编写一个VBA宏,使用本机windows语音功能将注释文本转换为语音
以前有人这样做过吗
有关于如何开始和继续的提示吗
最后,我将需要提供不同的欧盟语言进行转换

谢谢John。

好的,如上所述,在项目中添加对Microsoft Speech Object Library的引用

然后,此函数将为您设置正确的路径:

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
那么就称之为:

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

PPT本身无法直接访问,但您可以从PowerPoint中自动实现Excel的文本到语音引擎。您可以通过web搜索“excel文本到语音vba”(不带引号)之类的术语来查找示例。我在PowerPoint中使用vba的原型加载项中完成了此操作,尽管它确实使用了对Microsoft语音对象库的引用。我设法让它阅读幻灯片笔记,甚至使用自定义语音。我会找出一些代码,稍后再回复。谢谢Jamie,我会在明天开始的假期后试用它
希望你不要认为我会忘记!嗨,杰米,我应该在某处提供SpeechLib.SpVoice的链接吗?我收到一个错误,没有指定用户定义的类型。有什么线索吗?谢谢John@JamieGarroch你能就上述问题提出建议吗?我也面临同样的问题