+ Reply to Thread
Results 1 to 2 of 2

Can you auto-trigger a sound file to play when a worksheet opens?

  1. #1
    Nanotexan
    Guest

    Can you auto-trigger a sound file to play when a worksheet opens?

    I would like to have a sound wave play automatically when I open a particular
    Excel worksheet. I have already added the sound wave into the worksheet, but
    can't seem to find out how to have it self-trigger. Anyone have experience
    with this. Working on Windows XP

    Thanks

  2. #2
    jeffP
    Guest

    RE: Can you auto-trigger a sound file to play when a worksheet opens?

    Put these in a standard module:
    Private Declare Function playSound Lib "winmm.dll" _
    Alias "PlaySoundA" (ByVal lpszName As String, _
    ByVal hModule As Long, ByVal dwFlags As Long) As Long

    Sub Play_A_Wav()
    WAVFile = ThisWorkbook.Path & "\Your.wav"
    Call playSound(WAVFile, 0&, SND_ASYNC Or SND_FILENAME)
    End Sub

    In the worksheet you want it to play when you open put:
    Private Sub Worksheet_Activate()
    Call Play_A_Wav
    End Sub


    HTH
    [email protected]

    "Nanotexan" wrote:

    > I would like to have a sound wave play automatically when I open a particular
    > Excel worksheet. I have already added the sound wave into the worksheet, but
    > can't seem to find out how to have it self-trigger. Anyone have experience
    > with this. Working on Windows XP
    >
    > Thanks


+ 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