Monday, May 29, 2017

Play Musical Notes In Excel



           Musical notes (piano notes) can be played with buttons and functional keys in Excel.

- Ago, we added buttons to the worksheet .Then ,we assigned the macros to these buttons to play the music notes(.wav files) that are in the same place as the workbook. Example ;

  Private Sub CommandButton2_Click()
  Call sndPlaySound32(ThisWorkbook.Path & "\a1.wav", 0)
  Range("F2").Activate
  End Sub

- If desired music notes can be played with function keys F1, F2 etc. We used the following codes for this process :

Sub A_1()
    Call sndPlaySound32(ThisWorkbook.Path & "\a1.wav", 0)
End Sub
Sub auto_open()
Application.OnKey "{F1}", "A_1"
....
End Sub

No comments:

Post a Comment