ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Speech.Speak error (https://www.excelbanter.com/excel-programming/289752-speech-speak-error.html)

Doug Glancy

Speech.Speak error
 
I'm working on a Jeopardy game that uses the Speech.Speak method to read the
questions and answers and a double-click event to move through worksheets
containing them. I've found that double-clicking too soon after the Speak
command causes the macro to crash on the next line of code.

Here's a simple example. I've found that with the following module if I
double-click too soon a second time, the macro crashes. I tried inserting a
pause loop before the speech command, but that doesn't make a difference. I
think I understand why that doesn't work, something to do with keystroke
buffers, if that's the right term.

Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal Target
As Range, Cancel As Boolean)

Dim pause As Double

Cancel = True
Application.Speech.Speak Application.UserName & "is an excellent programmer"

End Sub

Any suggestions on how to fix?

Thanks,

Doug



Chip Pearson

Speech.Speak error
 
Doug,

Try

Application.Speech.Speak _
Application.UserName & "is an excellent programmer", True



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Doug Glancy" wrote in message
...
I'm working on a Jeopardy game that uses the Speech.Speak

method to read the
questions and answers and a double-click event to move through

worksheets
containing them. I've found that double-clicking too soon

after the Speak
command causes the macro to crash on the next line of code.

Here's a simple example. I've found that with the following

module if I
double-click too soon a second time, the macro crashes. I

tried inserting a
pause loop before the speech command, but that doesn't make a

difference. I
think I understand why that doesn't work, something to do with

keystroke
buffers, if that's the right term.

Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object,

ByVal Target
As Range, Cancel As Boolean)

Dim pause As Double

Cancel = True
Application.Speech.Speak Application.UserName & "is an

excellent programmer"

End Sub

Any suggestions on how to fix?

Thanks,

Doug





Doug Glancy

Speech.Speak error
 
Thanks Chip,

You are indeed an excellent programmer.

Doug


"Chip Pearson" wrote in message
...
Doug,

Try

Application.Speech.Speak _
Application.UserName & "is an excellent programmer", True



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Doug Glancy" wrote in message
...
I'm working on a Jeopardy game that uses the Speech.Speak

method to read the
questions and answers and a double-click event to move through

worksheets
containing them. I've found that double-clicking too soon

after the Speak
command causes the macro to crash on the next line of code.

Here's a simple example. I've found that with the following

module if I
double-click too soon a second time, the macro crashes. I

tried inserting a
pause loop before the speech command, but that doesn't make a

difference. I
think I understand why that doesn't work, something to do with

keystroke
buffers, if that's the right term.

Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object,

ByVal Target
As Range, Cancel As Boolean)

Dim pause As Double

Cancel = True
Application.Speech.Speak Application.UserName & "is an

excellent programmer"

End Sub

Any suggestions on how to fix?

Thanks,

Doug








All times are GMT +1. The time now is 07:51 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com