Generating a sound

iibobii

New Member
Joined
Feb 26, 2002
Messages
40
I know, I know, this is a stupid question, and you're wondering why would I ever want to do this, but is there any way to generate a sound (say a wav file) when you initially open an Excel document?

Thanks.
 
I GOT IT...the only problem...I was hoping to generate a sound when a specific file is opened, not when Excel is opened. Can that be changed somehow?

Thanks.
 
Upvote 0

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Ok, now I've managed to place it at the workbook level instead of the application level. One more question...PLEASE...right now I have to pull the wav file from my c drive. Is there a way to embed the wav file into the excel document. That way, if I send it to someone, it's attached.

Thanks...last question...I SWEAR.
 
Upvote 0
You can put it in a specific work book by opening up that workbook and doing everything in the previous walk through, but stop at the part whereI told you to save it as an .xla. Just save it as the workbook as normal. The problem with this is that it's now going to throw up the macro warning message whenever you open that workbook.

It is possible to embed a .wav file on a worksheet you would achieve this be going to "Insert|Object|Create From File" then browsing to your file.

Not sure how to reference this in the code you're using though. It may even be that we can play it without that code.

It's lunchtime, so I can't investigate right now. Hopefully you can.

Cheers
 
Upvote 0
I think you're right. The referencing part is the last piece that I have to figure out. If anyone knows how, please let me know.

Thanks.
 
Upvote 0
OK,

This is far far simpler. Scrap all of the code we have done so far. We don't need it.

1. Insert your *.wav object onto the sheet that you want.
2. Select the little sound object after you've inserted it and get the name from the combobox. e.g. My wav object is called "Object 2".
3. Right click on the icon to the left of File.
4. Insert this code:

<pre>
Worksheets("Sheet1").OLEObjects("Object 2").Verb
</pre>

5. Change "Sheet1" to whatever sheet you've put it on.
6. Change "Object 2" to whatever the name of your object is. i.e. the name we got in step 2.

This will work. It had better. I hope you're putting this to good use.

:)
 
Upvote 0
Hey Mark, this is what it looks like. The only problem I have though is that I get an error message saying that Sound Recorder is being used by another application. I don't see where it could possibly be used. Is this code right? Did I place it in the right spot?

Private Sub Workbook_Open()
Worksheets("Sheet1").OLEObjects("Object4").Verb
End Sub

Hey, for what it's worth, if I ever get this darn thing to work, I earned a 12 pack and some great laughs!!! If your cut is 20%, then I would owe you 2.4 beers.
 
Upvote 0
The object is definitely called "Object4" and not "Object 4"? (with a space)

This shouldn't generate the error you've mentioned, but it might.

If you've got CD Player or RealPlayer playing then this might screw it up, but it shouldn't make a difference.

Actually, on this my cut should be about 90%, I'll accept the money though. :wink:

_________________<font color = green> Mark O'Brien
This message was edited by Mark O'Brien on 2002-03-08 10:37
 
Upvote 0
Nothing is playing. Maybe I'll try to reboot sometime then try it again. I check the Task List and nothing shows up. Yes, I need the space. It's there, but when I cut/pasted the info, the space disappeared. I'll keep working on it. Hey, thanks so much for your help! Hopefully I'll figure this all out.

Bob
 
Upvote 0
Well, let me know how you get on.

Last quick question for you. You have actually got a soundcard in your machine don't you?
 
Upvote 0
I don't know what's in this machine. I'm at work. I get sounds when I receive mail, etc. I'm also able to play wav files, etc. I just can't figure out why it would say that sound recorder was being used by another application...nothing is running.

This stuff drives me nuts at times! :)
 
Upvote 0

Forum statistics

Threads
1,214,518
Messages
6,119,985
Members
448,935
Latest member
ijat

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