ที่ Module
Option Compare Database
#If Win64 Then
    Private Declare PtrSafe Function PlaySound Lib "winmm.dll" _
        Alias "PlaySoundA" (ByVal lpszName As String, _
        ByVal hModule As LongPtr, ByVal dwFlags As Long) As Boolean
#Else
    Private Declare Function PlaySound Lib "winmm.dll" _
        Alias "PlaySoundA" (ByVal lpszName As String, _
        ByVal hModule As Long, ByVal dwFlags As Long) As Boolean
#End If
Const SND_SYNC = &H0
Const SND_ASYNC = &H1
Const SND_FILENAME = &H20000
Function SoundMe() As String
    Call PlaySound("c:\windows\media\policesiren.WAV", 0, SND_ASYNC Or SND_FILENAME)
    SoundMe = ""
End Function
Public Sub StopSound()
    PlaySound vbNullString, 0, 0
End Sub
ที่ command button เพิ่ม
  SoundMe 'เมื่อเล่นเสียงแล้ว ต่อไปจะเด้ง msgbox ก็ดักเงื่อนไขการกด OK
  If MsgBox("ข้อมูลซ้ำกัน กรุณาตรวจสอบ", vbOKOnly, "program") = vbOK Then
    StopSound
  End If