Option Explicit
'Needs to set reference to MS Word VBA as shown below
'VBE | Tools | References | Microsoft Word 12.0 Object Library
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim vbMsgRes As VbMsgBoxResult
Dim tsk As Task
Dim wdApp As Word.Application
vbMsgRes = MsgBox("Do you want to close WinAmp also?", vbYesNo)
Select Case vbMsgRes
Case vbYes
'Create one instance of word which is hidden
Set wdApp = New Word.Application
wdApp.Visible = False
'Loop through all instances
For Each tsk In Tasks
If InStr(tsk.Name, "Winamp") > 0 Then
tsk.Close
End If
Next
wdApp.Quit
Case vbNo
'We do nothing if the input is no
End Select
End Sub
Private Sub Workbook_Open()
Const strPath As String = "C:Program FilesWinampwinamp.exe" 'Winamp path
Const strSong As String = "D:songs2 Jab Se Tere Naina.mp3" 'Put path of the song here
Shell strPath & " " & Chr(34) & strSong & Chr(34), 0
End Sub