The next and final step is to add this code to the PhraseFinish event of vcrVoice. This will make the computer reply to what you have said.
Select Case Phrase Case Is = YOURNAME spkSpeak.Speak "Hello " & YOURNAME Case Is = "What year is it?" spkSpeak.Speak Year(Date) End Select
The program works like this, the grammer is set and the Speech Recognition control is activated. When you finish a phrase the control activates the PhraseFinish event and then there is a test to get what you said and reply to it.
If you run the program it and say your name (the value of the constant YOURNAME) it will say "Hello " and then your name. If you then say "What year is it?" it will reply "It is the year " and then the year. If it doesn't understand you the first time try, try and try again until you are sure it does not work. Also, this may sound silly but make sure your speakers are on otherwise you could think the program is not working when it is! This simple program can make you able to talk to the computer. You can then extend this program so you can even have a conversation with the computer!
Comments