Voice activation software to run macros?

TedX

Board Regular
Joined
Apr 18, 2021
Messages
122
Office Version
  1. 365
Platform
  1. Windows
One of the reasons I like creating macros to speed things along in Excel is that I'm lazy. I assume I am not alone in that department 🤪

So my question is, is there any voice activation software around (even in Beta) that would let me say commands that would run macros?
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Yes. Yes you can!

Talking to Excel and running a macro
You can talk to excel using the Microsoft Speech Object Library
Wise owl has a nice tutorial on how to use it.

So what you do is set up the speech recognition event to a trigger, that might be a button, changing a cell, timer based. Anything.

Then inside the speech recognition event you put a switch case statement in to select your macro based on what you said and any key words that might act as optional parameters.

Getting excel to talk back (TTS)


What kind of applications do you think this could be used for?
 
Upvote 0
This is interesting, firstly thank you MCLIFTO8 for responding. I can tell you I read the tutorial from Wise Owl, then I looked at the Speech Object and dang if I didn't get the subroutine to say hello to me, what a buzz.

I'll explain using an image, exactly what I was hoping to do.

zzzzz485.jpg


My worksheet has lots of macros on the quick-access toolbar, using say NSW (indicated), this macro performs a task, which is different than the task for the other macros. So, I'd like to simply say NSW to get the macro to work. All the speech would be doing is simulating a mouse click, in reality, but I just think it would be ultra cool if I had a word for each macro i.e. the title of the macro, like Let's Roll, C6 and so on. What's your opinion on that? I suppose you could go further and say 'Record Macro' to start a new macro or perform any other action. So instead of the computer talking to me, I want to talk to it, instruct it on which macro or action I want it to perform. Is this doable, do you think?
 
Upvote 0
No worries Ted. I like your mad scientist vibes.
I just think it would be ultra cool if I had a word for each macro i.e. the title of the macro, like Let's Roll, C6 and so on.

I think so too. My co-worker scoffed at me but then I mentioned the potential utility of standing in a meeting and talking to excel like you would you google assistant. "Excel next sheet" "Excel show percentages" "Excel select Victoria Sales".
At the very least it would be a fun trick to pull on some boomer managers.

I think the utility will need refinement. We can simulate a click of the record macro button using it's three key - key board shortcut using "sendKeys". So we can certainly say, "Excel, record a macro.". However the detailed instructions of what to do in the macro record would probably be a job in itself.

So using voice has it's own overhead of effort that a mouse click just doesn't. You also need to activate the voice record somehow, whether via key presses or a button in your quick access. However a voice command can replace a complicated keyboard shortcut. It can aid in dictation and it can be a crutch for "non technical" excel users, of which there are far too many.

ex
  • Voice turns an unlimited amount of buttons into one button.
    You could turn those six ⚠️ buttons into a single "region" button that you say to Excel what region to run.

  • Voice can help you type quickly.

  • Voice macros can be given to users instead of a control panel of buttons in a userform in specific circumstances.


So voice commands are niche for a reason but if you want to use them for some cool factor in your workbooks. Why not!
 
Upvote 0
Okay, so I want to do this one step at a time, so I learn something. Firstly I made a small macro and placed it in my Personal file because initially I want it to work in one specific file but later on, I'd like it to work in as many files as I nominate.

VBA Code:
Sub HelloTed()
 
 Application.Speech.Speak "Hello Ted"
 
End Sub

This works fine, when I run it as a macro. What I want to do now is, associate it with the action of the file opening, I don't know how to do this. The idea is that every morning when I say Open Excel and it opens then I open this daily file of mine, that it greets me and says hello :biggrin:

Surely that's not so hard to do??? (perhaps o_O )
 
Upvote 0
Surely that's not so hard to do???
Let me be a little clearer. Let's say I have a working macro called SelectHighestValue, what I want to do is, say the words "Select Highest Value" and when Excel hears me say those 3 words, run the macro. I hope that explains my dream wish. It's sort of like reversing what normally happens when the Computer talks to you, I want to talk to the computer. 🙏

I just saw AlexOfRhodes response above and am watching the video now, this looks promising. I'll get back to you 👍
 
Last edited:
Upvote 0
I open this daily file of mine, that it greets me and says hello :biggrin:

There's an event you can use that as soon as the file opens it runs a macro. You could put your TTS in there I think.

VBA Code:
Private Sub Workbook_Open()
'put this in your workbook, not a module. 
 Application.Speech.Speak "Hello Ted"
 
End Sub
 
Upvote 0
I like your mad scientist vibes.
This had me literally laugh out loud. I couldn't agree more - I like the questions you ask, TedX!

Just one point to make sure I'm on the same page as you both - the link that MCLIFT08 originally posted does, in fact, do speech recognition and not just TTS. Forgive me if I'm missing something, but just looking at TedX's responses, I'm wondering if the points may not be connecting. Here is a link to the start of the Wise Owl tutorial on Speech Recognition (as opposed to TTS): Using your voice to fill in a VBA form . There is a link on that page to a workbook which demonstrates the functionality.

As for automating the recording of macros, I suspect (though haven't checked) that the ExecuteMSO method I referenced the other day on your other thread might be usable here for that... It might be a combination of ExecuteMSO and Sendkeys, actually. I might be wrong though.

(As a general rule, I like to think anything that can be done in Autohotkey can be done in VBA - though I'm being a bit optimistic with that at times, I think.)
 
Upvote 0
There's an event you can use that as soon as the file opens it runs a macro. You could put your TTS in there I think.

VBA Code:
Private Sub Workbook_Open()
'put this in your workbook, not a module.
 Application.Speech.Speak "Hello Ted"
 
End Sub
Sheer Genius, you nailed it, that is exactly what I wanted to do. I had the simple one-line sub in the wrong location. I can't tell you how excited I was to hear those two simple words, it was like the moon landing for me 😂🤣😂 So now, when I open the file it greets me, my next step is for me to say NSW (that's a state in Australia BTW, called New South Wales, abbreviated to NSW), which is different to other states like VIC & QLD etc. I just want to say "Run NSW), I would change my macro name to "run_nsw", so that the name and what I say are the same, if that's too hard, I'd call the macro 'number_one' and then say the words "Number One". Hopefully, the Macro would run (execute). I have some good leads on AutoHotkeys that I still need to work through, so the answer seems to lie there.

I opened a GitHub account that was like landing on an alien planet - everything is weird there 😂 I'm so glad my goto place for learning is right here on Mr Excel 😍
 
Upvote 0

Forum statistics

Threads
1,215,477
Messages
6,125,036
Members
449,205
Latest member
Eggy66

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top