+ Reply to Thread
Results 1 to 9 of 9

Playing a sound file from Excel

  1. #1
    Larry
    Guest

    Playing a sound file from Excel

    Here's what I'm trying to do - any help is appreciated.

    I have an Excel workbook with several worksheets. I want an audio file (in
    ..wma format) to start playing when I activate a worksheet. I've been able to
    play a .wav file using the sndPlaySound32 dll but it doesn't seem to work
    with a .wma file.

    Any suggestions??

    Thanks in advance,
    Larry



  2. #2
    Registered User
    Join Date
    02-07-2006
    Posts
    26
    One solution could be inserting the WMA fila as an object and call it from the code with:

    'Replace "Object 4" with the name of your object
    ActiveSheet.Shapes("Object 4").Select
    Selection.Verb Verb:=xlPrimary

    ...the only thing is that it will be open on your default player.

    Regards.

  3. #3
    Registered User
    Join Date
    02-07-2006
    Posts
    26
    One solution could be inserting the WMA fila as an object and call it from the code with:

    'Replace "Object 4" with the name of your object
    ActiveSheet.Shapes("Object 4").Select
    Selection.Verb Verb:=xlPrimary

    ...the only thing is that it will be open on your default player.

    Regards.

  4. #4
    Registered User
    Join Date
    02-07-2006
    Posts
    26
    One solution could be inserting the WMA fila as an object and call it from the code with:

    'Replace "Object 4" with the name of your object
    ActiveSheet.Shapes("Object 4").Select
    Selection.Verb Verb:=xlPrimary

    ...the only thing is that it will be open on your default player.

    Regards.

  5. #5
    dbarelli
    Guest

    RE: Playing a sound file from Excel

    One solution could be inserting the WMA fila as an object and call it from
    the code with:

    'Replace "Object 4" with the name of your object
    ActiveSheet.Shapes("Object 4").Select
    Selection.Verb Verb:=xlPrimary

    ....the only thing is that it will be open on your default player.

    Regards.

    "Larry" wrote:

    > Here's what I'm trying to do - any help is appreciated.
    >
    > I have an Excel workbook with several worksheets. I want an audio file (in
    > .wma format) to start playing when I activate a worksheet. I've been able to
    > play a .wav file using the sndPlaySound32 dll but it doesn't seem to work
    > with a .wma file.
    >
    > Any suggestions??
    >
    > Thanks in advance,
    > Larry
    >
    >


  6. #6
    dbarelli
    Guest

    RE: Playing a sound file from Excel

    One solution could be inserting the WMA fila as an object and call it from
    the code with:

    'Replace "Object 4" with the name of your object
    ActiveSheet.Shapes("Object 4").Select
    Selection.Verb Verb:=xlPrimary

    ....the only thing is that it will be open on your default player.

    Regards.

    "Larry" wrote:

    > Here's what I'm trying to do - any help is appreciated.
    >
    > I have an Excel workbook with several worksheets. I want an audio file (in
    > .wma format) to start playing when I activate a worksheet. I've been able to
    > play a .wav file using the sndPlaySound32 dll but it doesn't seem to work
    > with a .wma file.
    >
    > Any suggestions??
    >
    > Thanks in advance,
    > Larry
    >
    >


  7. #7
    dbarelli
    Guest

    RE: Playing a sound file from Excel

    One solution could be inserting the WMA fila as an object and call it from
    the code with:

    'Replace "Object 4" with the name of your object
    ActiveSheet.Shapes("Object 4").Select
    Selection.Verb Verb:=xlPrimary

    ....the only thing is that it will be open on your default player.

    Regards.

    "Larry" wrote:

    > Here's what I'm trying to do - any help is appreciated.
    >
    > I have an Excel workbook with several worksheets. I want an audio file (in
    > .wma format) to start playing when I activate a worksheet. I've been able to
    > play a .wav file using the sndPlaySound32 dll but it doesn't seem to work
    > with a .wma file.
    >
    > Any suggestions??
    >
    > Thanks in advance,
    > Larry
    >
    >


  8. #8
    Michel Pierron
    Guest

    Re: Playing a sound file from Excel

    Hi Larry;
    (sFile = Full name of wma file)

    Private Sub WMAPlay(sFile$)
    If Len(Dir(sFile)) < 8 Then Exit Sub
    CreateObject("WMPlayer.OCX").URL = sFile
    End Sub

    MP

    "Larry" <[email protected]> a écrit dans le message de news:
    [email protected]...
    > Here's what I'm trying to do - any help is appreciated.
    >
    > I have an Excel workbook with several worksheets. I want an audio file

    (in
    > .wma format) to start playing when I activate a worksheet. I've been able

    to
    > play a .wav file using the sndPlaySound32 dll but it doesn't seem to work
    > with a .wma file.
    >
    > Any suggestions??
    >
    > Thanks in advance,
    > Larry
    >
    >




  9. #9
    Don Guillett
    Guest

    Re: Playing a sound file from Excel

    put this in a REGULAR module

    Option Private Module
    Declare Function sndPlaySound Lib "WINMM.DLL" Alias "sndPlaySoundA" _
    (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long

    Private Sub playmysound()
    SoundName$ = "c:\TakeFive\TakeFive.wav"
    'SoundName$ = "c:\" & [myfolder] & "\" & [myfile] & ".wav"
    wFlags% = SND_ASYNC Or SND_NODEFAULT
    counter = 0
    Do Until counter = [timestoplay]
    x% = sndPlaySound(SoundName$, wFlags%)
    counter = counter + 1
    Loop
    End Sub

    --
    Don Guillett
    SalesAid Software
    [email protected]
    "Larry" <[email protected]> wrote in message
    news:[email protected]...
    > Here's what I'm trying to do - any help is appreciated.
    >
    > I have an Excel workbook with several worksheets. I want an audio file
    > (in
    > .wma format) to start playing when I activate a worksheet. I've been able
    > to
    > play a .wav file using the sndPlaySound32 dll but it doesn't seem to work
    > with a .wma file.
    >
    > Any suggestions??
    >
    > Thanks in advance,
    > Larry
    >
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1