I have added a wav file to a resource file, its in a folder called WAVE and it has an id of 101.

When I click on the command button, it does not play the sound, instead it plays a beep.

This is what I have:
VB Code:
  1. Option Explicit
  2.  
  3. Private Const SND_ASYNC = &H1
  4. Private Const SND_FILENAME = &H20000
  5.  
  6. Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As String, _
  7.                                                                        ByVal hModule As Long, _
  8.                                                                        ByVal dwFlags As Long) As Long
  9.  
  10. Public Sub ButtonClickSound(cb As CommandButton)
  11.     With cb
  12.         PlaySound LoadResData(101, "WAVE"), ByVal 0&, SND_FILENAME Or SND_ASYNC
  13.     End With
  14. End Sub
I am then calling it in the click event of the command button like so:
VB Code:
  1. ButtonClickSound Command1