Mario Theme Song – VBA

Moving on from the Computer beep from excel, this code will play the Mario Theme song, now it isn’t 100% exact but its pretty close!!

Paste this in to the VBA.
I have add this code to a button on the sheet.



Private Declare Function Beep Lib “kernel32” _
(ByVal dwFreq As Long, ByVal dwDuration As Long) As Long
┬áPublic Declare Sub Sleep Lib “kernel32” (ByVal dwMilliseconds As Long)
Sub Button1_Click()
Beep 660, 250
Beep 660, 250
Beep 660, 250
Beep 510, 250
Beep 660, 250
Beep 770, 250
Beep 380, 250
Beep 510, 250
Beep 380, 250
Beep 320, 250
Beep 440, 250
Beep 480, 200
Beep 450, 250
Beep 430, 250
Beep 380, 250
Beep 660, 200
Beep 760, 125
Beep 860, 250
Beep 700, 200
Beep 760, 125
Beep 660, 200
Beep 520, 200
Beep 580, 200
Beep 480, 200
Beep 510, 250
Beep 380, 250
Beep 320, 250
Beep 440, 250
Beep 480, 200
Beep 450, 250
Beep 430, 250
Beep 380, 250
Beep 660, 200
Beep 760, 125
Beep 860, 250
Beep 700, 200
Beep 760, 125
Beep 660, 200
Beep 520, 200
Beep 580, 200
Beep 480, 200
Beep 500, 250
Beep 760, 250
Beep 720, 250
Beep 680, 250
Beep 620, 375
Beep 650, 375
Beep 380, 250
Beep 430, 250
Beep 500, 250
Beep 430, 250
Beep 500, 250
Beep 570, 250
Beep 500, 250
Beep 760, 250
Beep 720, 250
Beep 680, 250
Beep 620, 375
Beep 650, 500
Beep 1020, 200
Beep 1020, 200
Beep 1020, 200
Beep 380, 250
Beep 500, 250
Beep 760, 250
Beep 720, 250
Beep 680, 250
Beep 620, 375
Beep 650, 375
Beep 380, 250
Beep 430, 250
Beep 500, 250
Beep 430, 250
Beep 500, 250
Beep 570, 250
Beep 585, 250
Beep 550, 250
Beep 500, 250
Beep 380, 250
Beep 500, 250
Beep 500, 250
Beep 500, 250
Beep 500, 250
Beep 760, 250
Beep 720, 250
Beep 680, 250
Beep 620, 375
Beep 650, 375
Beep 380, 250
Beep 430, 250
Beep 500, 250
Beep 430, 250
Beep 500, 250
Beep 570, 250
Beep 500, 250
Beep 760, 250
Beep 720, 250
Beep 680, 250
Beep 620, 375
Beep 650, 500
Beep 1020, 200
Beep 1020, 200
Beep 1020, 200
Beep 380, 250
Beep 500, 250
Beep 760, 250
Beep 720, 250
Beep 680, 250
Beep 620, 375
Beep 650, 375
Beep 380, 250
Beep 430, 250
Beep 500, 250
Beep 430, 250
Beep 500, 250
Beep 570, 250
Beep 585, 250
Beep 550, 250
Beep 500, 250
Beep 380, 250
Beep 500, 250
Beep 500, 250
Beep 500, 250
Beep 500, 150
Beep 500, 200
Beep 500, 150
Beep 500, 200
Beep 580, 200
Beep 660, 200
Beep 500, 200
Beep 430, 200
Beep 380, 200
Beep 500, 150
Beep 500, 200
Beep 500, 150
Beep 500, 200
Beep 580, 200
Beep 660, 200
Beep 870, 200
Beep 760, 200
Beep 500, 150
Beep 500, 200
Beep 500, 150
Beep 500, 200
Beep 580, 200
Beep 660, 200
Beep 500, 200
Beep 430, 200
Beep 380, 200
Beep 660, 250
Beep 660, 250
Beep 660, 250
Beep 510, 250
Beep 660, 250
Beep 770, 250
Beep 380, 250
End Sub
Enjoy!