BLOGS BY TOPIC▼
BLOGS BY AUTHOR▼
BLOGS BY YEAR▼
What happens when you combine the magic of speech recognition with the power of VBA? A user form which you can fill in without a keyboard!
- Using your voice to fill in a VBA form
- Setting up speech recognition (this blog)
- Integrating speech recognition with VBA
Posted by Andy Brown on 13 March 2020
You need a minimum screen resolution of about 700 pixels width to see our blogs. This is because they contain diagrams and tables which would not be viewable easily on a mobile phone or small laptop. Please use a larger tablet, notebook or desktop computer, or change your screen resolution settings.
Setting up speech recognition
You won't be able to detect speech from within VBA if your computer isn't listening! This page shows how to configure speech recognition on your computer.
I'm using a Dell Precision laptop running Windows 10 Professional, but I suspect these instructions will work for any reasonably modern Windows computer.
Starting speech recognition - setting up your microphone
First, go to the Windows speech recognition program:

The program to run on your computer (I typed Spe in the Type here to search box, which was sufficient to find this).
The speech recognition toolbar may appear, in which case right-click to choose to configure your microphone:

If this is the first time you've used speech recognition, Windows may miss out this step and ask if you want to go straight to configuring your microphone.
Choose your microphone:

I don't have an external microphone connected to my computer, so I've chosen this option to use my laptop's internal microphone.
Keep going through the wizard, and you'll be asked to entertain the people who share your office:

How to make friends and influence people ...
Training speech recognition
If you're serious about using speech recognition, you should now train the algorithm to recognise your voice:

Right-click on the speech recognition toolbar and choose to train your computer!
I confess that I haven't done this (which could be why my results are so garbled). Maybe, deep down, I'm not serious about speech recognition ...
Turning speech recognition on and off
You can right-click on the speech recognition toolbar to choose your listening mode:

You can show the toolbar by clicking on this icon in the task bar.
Depending on how much you value your privacy, you can either tell Cortana to listen to everything you say, or just when you say start listening:

... or you can tell Cortana not to listen at all!
You can stop listening by saying stop listening.
The easiest way to turn listening on and off, however, is to press the Windows key with the Ctrl key held down.
And with that, you're in business!

Not a bad first attempt! To accept what your computer recognised, click on the Insert button.
You can test out speech recognition by issuing commands, such as Open Excel. Time now to integrate speech recognition with VBA!
- Using your voice to fill in a VBA form
- Setting up speech recognition (this blog)
- Integrating speech recognition with VBA