This great macro:
Sub ReadToMe()
Set objRange = Selection.Range
strText = objRange.Text
Set objVoice = CreateObject("SAPI.SpVoice")
objVoice.Speak strText
End Sub

From Steve Yandl

Speaks the selected text
However, I cannot stop it once it starts.
How does one kill a macro

WORD 2003

Al

Re: How to stop speak macro by Jean-Guy

Jean-Guy
Wed Feb 14 20:56:48 CST 2007

A was telling us:
A nous racontait que :

> This great macro:
> Sub ReadToMe()
> Set objRange = Selection.Range
> strText = objRange.Text
> Set objVoice = CreateObject("SAPI.SpVoice")
> objVoice.Speak strText
> End Sub
>
> From Steve Yandl
>
> Speaks the selected text
> However, I cannot stop it once it starts.
> How does one kill a macro

What do you mean by "I cannot stop it once it starts"?
Does it repeat the text ad infinitum?

Just in case, have you tried:

Sub ReadToMe()

Dim objRange As Range
Dim strText As String
Dim objVoice As Object

Set objRange = Selection.Range
strText = objRange.Text
Set objVoice = CreateObject("SAPI.SpVoice")
objVoice.Speak strText

Set objVoice = Nothing

End Sub





--

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org



Re: How to stop speak macro by Steve

Steve
Thu Feb 15 13:18:20 CST 2007

The object created does have a 'pause' method and a 'restore' method.
However, the few times I've used it, I simply supplied it with small enough
text strings that I didn't see the need to stop it (you could break down a
large selection into a collection of sentences perhaps).

By the way, you should add the line suggested by Jean-Guy Marcil to set the
object to nothing at the end of the subroutine. I don't think it will solve
your problem but I should have included it when I initially provided you the
sample subroutine.

Steve Yandl


"A" <pat-al.serranonospam@att.net> wrote in message
news:jpIAh.3$Zm.1@dfw-service2.ext.ray.com...
> This great macro:
> Sub ReadToMe()
> Set objRange = Selection.Range
> strText = objRange.Text
> Set objVoice = CreateObject("SAPI.SpVoice")
> objVoice.Speak strText
> End Sub
>
> From Steve Yandl
>
> Speaks the selected text
> However, I cannot stop it once it starts.
> How does one kill a macro
>
> WORD 2003
>
> Al



Re: How to stop speak macro by Graham

Graham
Fri Feb 16 01:17:33 CST 2007

See http://www.gmayor.com/word_text_to_speech.htm

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

A wrote:
> This great macro:
> Sub ReadToMe()
> Set objRange = Selection.Range
> strText = objRange.Text
> Set objVoice = CreateObject("SAPI.SpVoice")
> objVoice.Speak strText
> End Sub
>
> From Steve Yandl
>
> Speaks the selected text
> However, I cannot stop it once it starts.
> How does one kill a macro
>
> WORD 2003
>
> Al