Run next lines of code while voice still playing

kelly mort

Well-known Member
Joined
Apr 10, 2017
Messages
2,169
Office Version
  1. 2016
Platform
  1. Windows
Code:
Sub TestVoices()
Dim i  As Long
Dim voc As SpeechLib.SpVoice
Set voc  = New SpVoice

i  = [RANDBETWEEN(0,2)]

Set voc.Voice = voc.GetVoices.Item(i)

voc.Speak "I want to run next lines while voice is playing"

MsgBox i 

End Sub

In other versions I could do that , like this:

Code:
Application. Speech.Speak "Hello", SpeakAsync:=True

What is it that I have to do to the first code to let the alert show while the voice is playing?
 
Not knowing about the SpeechLib library, I don't think I can help any furhter.

VBA can't do multithreading unless the code is executed inside a loaded dll.

One possible workaround is to run the voice from a seperate excel instance but that will rquire some setup work .


Okay

Thanks for the help
 
Upvote 0

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type

Forum statistics

Threads
1,213,484
Messages
6,113,920
Members
448,533
Latest member
thietbibeboiwasaco

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