Try this
This goes in the Declarations section of your code
Option Explicit
Private Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
Private Const SND_ASYNC = &H1
Private Const SND_LOOP = &H8
Private Const SND_SYNC = &H0
Private SoundWasPlayed As Boolean
And here are the other procedures
Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim ret As Long
If SoundWasPlayed = False Then
ret = sndPlaySound("C:\windows\media\ding.wav", SND_ASYNC)
End If
SoundWasPlayed = True
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
SoundWasPlayed = False
End Sub