




السلام عليكم ورحمة الله وبركاته
كود:
Declare Function apisndPlaySound Lib "winmm" Alias "sndPlaySoundA" _
(ByVal filename As String, ByVal snd_async As Long) As Long
Function PlaySound(sWavFile As String)
' Purpose: Plays a sound.
' Argument: the full path and file name.
If apisndPlaySound(sWavFile, 1) = 0 Then
MsgBox "The Sound Did Not Play!"
End If
End Function
وفي حدث عند نقر زر أمر مثلا اكتب :
كود:
PlaySound Application.CurrentProject.Path & "\telephone.wav"
وكما ترى يلزم تمرير اسم الملف والمسار إليه كاملا . وفي المثال السابق افترضت أن الملف الصوتي المسمى telephone يوجد في نفس مجلد قاعدة البيانات . لتمرير ملف في مكان آخر مثلا :
كود:
PlaySound "C:\Windows\telephone.wav"