Jump to content

Welcome to Geeks to Go - Register now for FREE

Geeks To Go is a helpful hub, where thousands of volunteer geeks quickly serve friendly answers and support. Check out the forums and get free advice from the experts. Register now to gain access to all of our features, it's FREE and only takes one minute. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more.

Create Account How it Works

Excel Macro-Inbed sound (wav) upon opening

  • Please log in to reply



    New Member

  • Member
  • Pip
  • 1 posts
Hi; does anyone know how to create a macro in Excel, so that when opening a particular spreadsheet by double clicking, a wav sound starts playing?

I was thinking to place the wav sound on a spreadsheet within the workbook, so it can travel (i.e. I can e-mail it to people and it will work on their computers as well).

Thanks for any help you can give me.

Best to all.
  • 0




    Retired Staff

  • Retired Staff
  • 11,365 posts
Open the workbook, hit ALT-f11

Enter the following in the THISWORKBOOK section of the VBA project

Place the appropriate sound file in the same directory as your workbook

Private Declare Function sndPlaySound32 Lib "winmm.dll" Alias "sndPlaySoundA" _
    (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
Sub workbook_open()
    If Application.CanPlaySounds Then
        Call sndPlaySound32("alert.wav", 1)
    End If
End Sub

  • 0



    Retired Staff

  • Retired Staff
  • 11,365 posts
oh, and change he code to reference the appropriate sound;)
  • 0

Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP