The program is design to play sound.
when I select a .wav or .midi file to play,there is an error that is "the function is undeclared",but why?

Is there any errors when I use the playsound(...)function?

the code is as follow:

Private Sub Drive1_Change()
On Error GoTo check
Dir1.Path = Drive1.Drive
Exit Sub
check:
MsgBox "The driver is unavailable!"
Drive1.Drive = "c:\"
Resume Next
End Sub

Private Sub Dir1_Change()
File1.Path = Dir1.Path
End Sub
Private Sub Command1_Click()
Dim filename As String
Dim Error As Long
If Right(File1.Path, 1) = "\" Then
filename = File1.Path + File1.filename
Else
filename = File1.Path + "\" + File1.filename
End If
Error = PlaySound(filename, 0, SND_FILENAME Or SND_SYNC)
End Sub