A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
oem7110 wrote:
When I click cell B4 to run following macro, it pops up following error.
The object public is unknown format or error on Declare object.
[....]
Declare Function sndPlaySound32 Lib "winmm.dll" Alias "sndPlaySoundA" _
**** (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long****Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("B4")) Is Nothing Then
Call sndPlaySound32("D:\CT1.wav", 0)
End If
End Sub
I get the following error:
For me, the fix is:
Private Declare Function sndPlaySound32 Lib "winmm.dll" Alias "sndPlaySoundA" _
**** (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
Of course, your call assumes that ".wav" file exists in the root directory of device "D:".
That is certainly not the case on my system. Only you can determine if that is the case on your system.