Microsoft Office programs can run voice commands with the speech recognition feature which can be installed as part of a MS Office installation.
This code will translate the text "Hello world!" to speech:
Sub SpeakText()
Application.Speech.Speak "Hello world!"
End Sub
SpeakAsync Parameter
'When set to False, will not execute the next code until speech is complete.
Sub waitSpeech()
Application.Speech.Speak "Complete me first", false
MsgBox "Speech completed first."
End Sub
'When set to True, will execute the next code even the speech is not yet complete.
Sub simultaneousWithSpeech()
Application.Speech.Speak "Don't wait for the speech to complete", true
MsgBox "I run simultaneously with the speech."
End Sub
No comments:
Post a Comment