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
 

Some videos you may like

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.

DRJ

MrExcel MVP
Joined
Feb 17, 2002
Messages
3,853
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
 

golf4

Active Member
Joined
Jul 8, 2002
Messages
452
Thanks for the suggestions, Jacob -

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

Take care,

Golf
 

Watch MrExcel Video

Forum statistics

Threads
1,122,469
Messages
5,596,326
Members
414,053
Latest member
Dual Showman

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
Top