Error Handling for speech module?

SURFER349

Board Regular
Joined
Feb 22, 2017
Messages
50
So I've got this code to talk to the user while the macro runs, to prevent them from clicking all over the place and crashing the program.


Code:
Sub UseSpeech() 'speech while macro runs. 
Application.Speech.Speak "Hello  " & Application.UserName & ".  Please wait about 10 seconds while the macro runs in the background.", SpeakAsync:=True
End Sub

So it works great on most computers, but some people are getting this error.

Run-time error '-214720096 (8004503a)
Method 'Speak' of object 'Speech' failed

I don't want to ask all these old people to update their dll's and objects. Can someone help me with syntax for an error handling that will skip if there's an error here?
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.

shg

MrExcel MVP
Joined
May 7, 2008
Messages
21,829
Office Version
  1. 2010
Platform
  1. Windows
If I were a user, I'd prefer that you put up a modal userform, perhaps with a progress bar, until the macro completes. I don't like my computer speaking unless spoken to.
 

SURFER349

Board Regular
Joined
Feb 22, 2017
Messages
50
If I were a user, I'd prefer that you put up a modal userform, perhaps with a progress bar, until the macro completes. I don't like my computer speaking unless spoken to.

Good idea. Tips or link on how to make this happen? or some sort of big gif that is splashed across the screen?
 

SURFER349

Board Regular
Joined
Feb 22, 2017
Messages
50

ADVERTISEMENT

very interesting, but i have no idea how I'm supposed to integrate this into a macro.
 

shg

MrExcel MVP
Joined
May 7, 2008
Messages
21,829
Office Version
  1. 2010
Platform
  1. Windows
Did you look at the code in the workbook?
 

SURFER349

Board Regular
Joined
Feb 22, 2017
Messages
50

ADVERTISEMENT

Did you look at the code in the workbook?

yes, it says 'insert code here' but then keeps popping up w/ the tabbed example box. And it seems I can't copy/move that userform to my existing workbook file.
 

shg

MrExcel MVP
Joined
May 7, 2008
Messages
21,829
Office Version
  1. 2010
Platform
  1. Windows
yes, it says 'insert code here' but then keeps popping up w/ the tabbed example box.

I don't know what that means.

Did you try exporting the userform of interest to a folder and then importing it?

Or you could open the workbook in your version of Excel, save it as an xlsm file, and them move your data into it.

You're a little stingy with details.
 
Last edited:

SURFER349

Board Regular
Joined
Feb 22, 2017
Messages
50
so i'm not sure if you're looking at something different. The file from your link "progressmeters.xls" has a single button on it, which pops up a user form to demonstrate various progress bars.

when inspecting the script for these, you see they are on "userform1" and its a list of many different subs. Each says "Your code would go here".

So inserting my code, or even just a short thing to do a few cell manipulations, then F5, just brings up the userform popup again, with all the tabs and examples.

Exporting the form and importing it to my original workbook does the same thing. It pops up the userform demonstrating examples of the different progress bars.

On top of that, it appears to be re-running my code each time the progress bar increments. So its re-running a big macro a hundred times to get from 0-->100 progress.
 

shg

MrExcel MVP
Joined
May 7, 2008
Messages
21,829
Office Version
  1. 2010
Platform
  1. Windows
The basic notion of a progress meter is that you need either need to have

o a loop that iterates until done, in which case you increment a variable from 0 to 1 (0% to 100%), and pass that variable to the code in a form that displays in in some fashion, or

o code that does several things, and you decide (maybe pretty arbitrarily) what fraction is complete in each step, and you pass that variable (0 to 1) to the form code.

The point in either case is just to show the user that things are happening, the computer isn't frozen, calm down and wait.
 
Last edited:
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,152,115
Messages
5,768,196
Members
425,459
Latest member
Danniey

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
Top