Generating a sound - Page 2
Amazing chart utilities from Jon Peltier
Thanks Thanks:  0
Likes Likes:  0
Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 25

Thread: Generating a sound

  1. #11
    New Member
    Join Date
    Feb 2002
    Posts
    40
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

     
    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.

  2. #12
    New Member
    Join Date
    Feb 2002
    Posts
    40
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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.

  3. #13
    MrExcel MVP Mark O'Brien's Avatar
    Join Date
    Feb 2002
    Location
    Columbus, OH, USA
    Posts
    3,530
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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


  4. #14
    New Member
    Join Date
    Feb 2002
    Posts
    40
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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.

  5. #15
    MrExcel MVP Mark O'Brien's Avatar
    Join Date
    Feb 2002
    Location
    Columbus, OH, USA
    Posts
    3,530
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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:


    Worksheets("Sheet1").OLEObjects("Object 2").Verb


    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.




  6. #16
    New Member
    Join Date
    Feb 2002
    Posts
    40
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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.

  7. #17
    MrExcel MVP Mark O'Brien's Avatar
    Join Date
    Feb 2002
    Location
    Columbus, OH, USA
    Posts
    3,530
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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.

    _________________
    [b] Mark O'Brien

    [ This Message was edited by: Mark O'Brien on 2002-03-08 10:37 ]

  8. #18
    New Member
    Join Date
    Feb 2002
    Posts
    40
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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

  9. #19
    MrExcel MVP Mark O'Brien's Avatar
    Join Date
    Feb 2002
    Location
    Columbus, OH, USA
    Posts
    3,530
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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?

  10. #20
    New Member
    Join Date
    Feb 2002
    Posts
    40
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

      
    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!

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

 

 
DMCA.com