meobeothaman
Thành viên mới

- Tham gia
- 13/6/16
- Bài viết
- 2
- Được thích
- 0

Hiện em đang tạo VBA excel đọc file nhạc trong đó có 1 Sub thì bị lỗi này ở dòng đầu tiên mãi không sửa dược trên 64bit, e cũng đã Delcare lại theo format của 64bit dưới dạng Public Declare để hết lỗi của cái Function sndplaysound32 ở module khác sang module này bó tay, sửa mãi vẫn lỗi này, không ăn thua (32 bit thì chạy nhòe ạ), cái này cũng là lượm lặt được trên mạng. Mong các cao nhân chỉ dạy, chân thành cảm ơn các bác!



Lỗi: Arguement is not Optional
Sub PlayTheSound(ByVal WhatSound As String, Optional Flags As Long = 0)
If Dir(WhatSound, vbNormal) = "" Then
' WhatSound is not a file. Get the file named by
' WhatSound from the Windows\Media directory.
WhatSound = Environ("SystemRoot") & "\Media" & WhatSound
If InStr(1, WhatSound, ".") = 0 Then
' if WhatSound does not have a .wav extension,
' add one.
WhatSound = WhatSound & ".wav"
End If
If Dir(WhatSound, vbNormal) = vbNullString Then
' Can't find the file. Do a simple Beep.
Beep
Exit Sub
End If
Else
' WhatSound is a file. Use it.
End If
' Finally, play the sound.
sndPlaySound32 WhatSound, Flags
End Sub