One More on Wavs

golf4

Active Member
Joined
Jul 8, 2002
Messages
452
Hi, everyone -

I have one additional question on the use of wav files. I'm now using wavs throughout integral part of my income calculation tool (THANKS, JACOB!!!) I have one more question on wavs in my opening splash. I was looking to use two different wavs on the splash --- one right after the other. My modified code is below:

Private Sub UserForm_Activate()
Application.ScreenUpdating = True
DoEvents
ActiveSheet.Shapes("object 201.wav").Select 'hockey theme'
Selection.Verb Verb:=xlPrimary

ActiveSheet.Shapes("object 202.wav").Select 'welcome message'
Selection.Verb Verb:=xlPrimary

Application.OnTime Now + TimeValue("00:00:015"), "KillTheForm"
End Sub


What seems to be happening is that both wav files are playing at the same time. Since this will, probably, be the only place where I will use two wavs, I'm wondering whether there was a code strip that will allow me to play one file AFTER the other?

Thanks for the help,

Golf
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
You can use Application.Wait after the first wav and before the second to pause the macro for say 2 seconds. Or you can put the second wav call in a seperate sub and call it with the Application.OnTime and just wait a few seconds or however long the first wav file is.

If you want to wait under a second we can make excel do some nonsence calculations to bide its time.

Code:
Private Sub UserForm_Activate() 
Application.ScreenUpdating = True 
DoEvents 
ActiveSheet.Shapes("object 201.wav").Select 'hockey theme' 
Selection.Verb Verb:=xlPrimary 

For x = 1 to 100
    For y = 1 to 100
        z=x*x + x*y + 2*x*y
    Next y
Next x

ActiveSheet.Shapes("object 202.wav").Select 'welcome message' 
Selection.Verb Verb:=xlPrimary 

Application.OnTime Now + TimeValue("00:00:015"), "KillTheForm" 
End Sub

Just change the 100 as needed to speed up or slow down the code.

You can also use the Timer

MyTimer = Timer

Do
Loop while Timer - MyTimer < 1
 
Upvote 0
Thanks for the suggestions, Jacob -

Once again, ..... works like a charm. (y)

Take care,

Golf
 
Upvote 0

Forum statistics

Threads
1,215,063
Messages
6,122,935
Members
449,094
Latest member
teemeren

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