I have a scoreboard that shows our operators how much of each commodity needs to built for each hour of the workday. Ten minutes before each hour a song automatically plays to alert our workers that they need to hustle. As of now my randomizer chooses from a set list of songs located in a folder, these songs have gotten old. Is there a way to use my randomizer to access say Pandora or some other streaming music site at the same time every hour so that the music played isn't heard over and over? Below is what my macro looks like
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hWnd As Long, _
ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, _
ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Sub MyMacro()
Application.OnTime TimeValue("00:50:00"), "MyMacro"
Application.OnTime TimeValue("1:50:00"), "MyMacro"
Application.OnTime TimeValue("2:50:00"), "MyMacro"
Application.OnTime TimeValue("3:50:00"), "MyMacro"
Application.OnTime TimeValue("4:50:00"), "MyMacro"
Application.OnTime TimeValue("5:50:00"), "MyMacro"
Application.OnTime TimeValue("6:50:00"), "MyMacro"
Application.OnTime TimeValue("7:50:00"), "MyMacro"
Application.OnTime TimeValue("8:50:00"), "MyMacro"
Application.OnTime TimeValue("9:50:00"), "MyMacro"
Application.OnTime TimeValue("10:50:00"), "MyMacro"
Application.OnTime TimeValue("11:50:00"), "MyMacro"
Application.OnTime TimeValue("12:50:00"), "MyMacro"
Application.OnTime TimeValue("13:50:00"), "MyMacro"
Application.OnTime TimeValue("14:50:00"), "MyMacro"
Application.OnTime TimeValue("15:50:00"), "MyMacro"
Application.OnTime TimeValue("16:50:00"), "MyMacro"
Application.OnTime TimeValue("17:50:00"), "MyMacro"
Application.OnTime TimeValue("18:50:00"), "MyMacro"
Application.OnTime TimeValue("19:50:00"), "MyMacro"
Application.OnTime TimeValue("20:50:00"), "MyMacro"
Application.OnTime TimeValue("21:50:00"), "MyMacro"
Application.OnTime TimeValue("22:50:00"), "MyMacro"
Application.OnTime TimeValue("23:50:00"), "MyMacro"
Dim MyNumber As Integer
Dim Song As String
Randomize Timer
MyNumber = Application.WorksheetFunction.RoundUp(Rnd() * 16, 0)
Select Case True
Case MyNumber = 1
Song = "C:\Users\iowa\Music\song1"
Case MyNumber = 2
Song = "C:\Users\iowa\Music\song2"
Case MyNumber = 3
Song = "C:\Users\iowa\Music\song3"
Case MyNumber = 4
Song = "C:\Users\iowa\Music\song4"
Case MyNumber = 5
Song = "C:\Users\iowa\Music\song5"
Case MyNumber = 6
Song = "C:\Users\iowa\Music\song6"
Case MyNumber = 7
Song = "C:\Users\iowa\Music\song7"
Case MyNumber = 8
Song = "C:\Users\iowa\Music\song8"
End Select
Dim handle As Long
handle = ShellExecute(0, "Open", Song, 0, 0, SW_SHOWNORMAL)
End Sub
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hWnd As Long, _
ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, _
ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Sub MyMacro()
Application.OnTime TimeValue("00:50:00"), "MyMacro"
Application.OnTime TimeValue("1:50:00"), "MyMacro"
Application.OnTime TimeValue("2:50:00"), "MyMacro"
Application.OnTime TimeValue("3:50:00"), "MyMacro"
Application.OnTime TimeValue("4:50:00"), "MyMacro"
Application.OnTime TimeValue("5:50:00"), "MyMacro"
Application.OnTime TimeValue("6:50:00"), "MyMacro"
Application.OnTime TimeValue("7:50:00"), "MyMacro"
Application.OnTime TimeValue("8:50:00"), "MyMacro"
Application.OnTime TimeValue("9:50:00"), "MyMacro"
Application.OnTime TimeValue("10:50:00"), "MyMacro"
Application.OnTime TimeValue("11:50:00"), "MyMacro"
Application.OnTime TimeValue("12:50:00"), "MyMacro"
Application.OnTime TimeValue("13:50:00"), "MyMacro"
Application.OnTime TimeValue("14:50:00"), "MyMacro"
Application.OnTime TimeValue("15:50:00"), "MyMacro"
Application.OnTime TimeValue("16:50:00"), "MyMacro"
Application.OnTime TimeValue("17:50:00"), "MyMacro"
Application.OnTime TimeValue("18:50:00"), "MyMacro"
Application.OnTime TimeValue("19:50:00"), "MyMacro"
Application.OnTime TimeValue("20:50:00"), "MyMacro"
Application.OnTime TimeValue("21:50:00"), "MyMacro"
Application.OnTime TimeValue("22:50:00"), "MyMacro"
Application.OnTime TimeValue("23:50:00"), "MyMacro"
Dim MyNumber As Integer
Dim Song As String
Randomize Timer
MyNumber = Application.WorksheetFunction.RoundUp(Rnd() * 16, 0)
Select Case True
Case MyNumber = 1
Song = "C:\Users\iowa\Music\song1"
Case MyNumber = 2
Song = "C:\Users\iowa\Music\song2"
Case MyNumber = 3
Song = "C:\Users\iowa\Music\song3"
Case MyNumber = 4
Song = "C:\Users\iowa\Music\song4"
Case MyNumber = 5
Song = "C:\Users\iowa\Music\song5"
Case MyNumber = 6
Song = "C:\Users\iowa\Music\song6"
Case MyNumber = 7
Song = "C:\Users\iowa\Music\song7"
Case MyNumber = 8
Song = "C:\Users\iowa\Music\song8"
End Select
Dim handle As Long
handle = ShellExecute(0, "Open", Song, 0, 0, SW_SHOWNORMAL)
End Sub