Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / February 2007

Tip: Looking for answers? Try searching our database.

How to stop speak macro

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
A - 14 Feb 2007 18:19 GMT
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
Jean-Guy Marcil - 15 Feb 2007 02:56 GMT
A was telling us:
A nous racontait que :

> This great macro:
> Sub ReadToMe()
[quoted text clipped - 9 lines]
> 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

Signature

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

Steve Yandl - 15 Feb 2007 19:18 GMT
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

> This great macro:
> Sub ReadToMe()
[quoted text clipped - 13 lines]
>
> Al
Graham Mayor - 16 Feb 2007 07:17 GMT
See http://www.gmayor.com/word_text_to_speech.htm

Signature

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

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

> This great macro:
> Sub ReadToMe()
[quoted text clipped - 13 lines]
>
> Al
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.