Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Option Explicit
Private Const SND_ASYNC = &H1
Private Const SND_FILENAME = &H20000
Private Const SND_NOWAIT = &H2000
Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long
Sub Button1_Click()
PlaySound ThisWorkbook.Path & "\ButtonClick.wav", ByVal 0&, SND_FILENAME Or SND_ASYNC Or SND_NOWAIT
End Sub
Private Sub PlayMedia()
Dim oMediaPlayer As Object
Set oMediaPlayer = CreateObject("WMPlayer.OCX")
oMediaPlayer.settings.volume = 100
oMediaPlayer.URL = "c:\windows\media\town.mid"
oMediaPlayer.Close 'to stop playing - Closes the player resources
Set oMediaPlayer = Nothing
End Sub