+ Reply to Thread
Results 1 to 13 of 13

Play sound file at set time each day

  1. #1
    Registered User
    Join Date
    12-20-2008
    Location
    Perth, Western Australia
    MS-Off Ver
    Microsoft - Office Enterprise 2007
    Posts
    28

    Play sound file at set time each day

    Hello!

    I'm trying to automate/keep records of my day by setting up a spreadsheet which : 1) Plays a wav music file at a schedule time as a reminder and 2) at the same time calls up a form where I can enter the results of the activity then 3) saves the results to a sheet where consecutive daily records can be recorded and graphed.

    Example

    At 5am each day I want a "Motivation.wav" music file to open and play and a form appear where I enter in the number of sit ups, push-ups I get done, which I enter in the form and it gets saved to a sheet where I can graph my progress based on the results recorded.

    Is this possible in Excel 2003 or is there a better way of automating this
    Last edited by VBA Noob; 12-21-2008 at 07:23 AM.

  2. #2
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573
    Welcome to the forum!

    You can set your xls to play the sound file in the Open event. In Windows Scheduled Events, add a BAT filename that contains the path to your xls.

  3. #3
    Registered User
    Join Date
    12-20-2008
    Location
    Perth, Western Australia
    MS-Off Ver
    Microsoft - Office Enterprise 2007
    Posts
    28

    Play sound at a series of time events

    I wish a macro to compare present time with a scheduled time, and if equal, to play a wav file at that time as a reminder then a dialogue box to add results of that event please, not just on opening, but during the day too.

  4. #4
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573
    You said you wanted it done at 5 AM. The method that I gave does that for you.

    Was there some other criterion? If so I would need to know.

    If you don't want to use Windows Scheduler, then you would need to leave the Excel file open and use the OnTime method.

  5. #5
    Registered User
    Join Date
    12-20-2008
    Location
    Perth, Western Australia
    MS-Off Ver
    Microsoft - Office Enterprise 2007
    Posts
    28
    Hopefully, T would have 5 different times in the same day to be alerted to by playing different music. I have a simple contional test that returns "true" when the scheduled time arrives, but I have to hit F9 to get the sheet to recalculate. How can the spreadsheet tick over as time passes then set off the conditional test which then activates the playing of the souns please?

  6. #6
    Registered User
    Join Date
    12-20-2008
    Location
    Perth, Western Australia
    MS-Off Ver
    Microsoft - Office Enterprise 2007
    Posts
    28

    OnTime method.

    What does this relate to and how can I use it?

  7. #7
    Registered User
    Join Date
    12-11-2008
    Location
    Lexington, KY
    Posts
    14
    You will either have to launch the Excel file at a certain time (Use Windows scheduler, similar to what Kenneth Hobson said), or leave the file open with an 'Ontime Method' (again, as Kenneth Hobson said). Once you decide which path you want to travel, that will decide the code behind that we can guide you on. ~G

  8. #8
    Registered User
    Join Date
    03-15-2007
    Posts
    17
    Quote Originally Posted by thetaplus View Post
    At 5am each day I want a "Motivation.wav" music file to open and play and a form appear where I enter in the number of sit ups, push-ups I get done,
    I can't offer much advice regarding your Excel question but I would have to say that you are the most driven person I have ever met. :-)

  9. #9
    Registered User
    Join Date
    12-20-2008
    Location
    Perth, Western Australia
    MS-Off Ver
    Microsoft - Office Enterprise 2007
    Posts
    28
    Hello !

    I wish to leave it open, have the music activate a different scheduled times, then pull up a form so I can enter in the results of that particular activity please

    Regards

  10. #10
    Registered User
    Join Date
    12-20-2008
    Location
    Perth, Western Australia
    MS-Off Ver
    Microsoft - Office Enterprise 2007
    Posts
    28
    so far i have this which works to play the music file


    ['This function declaration must be entered onto a single line.
    Declare Function sndPlaySound32 Lib "winmm.dll" Alias "sndPlaySoundA" _
    (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long

    Sub PlaySound1()
    If Application.CanPlaySounds Then
    'Substitute the path and filename of the sound you want to play
    Call sndPlaySound32("C:\Documents and Settings\Ishman\My Documents\excel\Music for Excel\MissionPossible.wav", 0)
    End If
    End Sub]

    Do I put in something like this please?

    Application.OnTime TimeValue("13:07:00"), "PlaySound1"

  11. #11
    Registered User
    Join Date
    12-20-2008
    Location
    Perth, Western Australia
    MS-Off Ver
    Microsoft - Office Enterprise 2007
    Posts
    28
    Sort of like a New Year's Resolution - have the spreadsheet remind me audibly what I should be doing to get my life on course!

  12. #12
    Registered User
    Join Date
    12-20-2008
    Location
    Perth, Western Australia
    MS-Off Ver
    Microsoft - Office Enterprise 2007
    Posts
    28
    so far i have this which works to play the music file


    ['This function declaration must be entered onto a single line.
    Declare Function sndPlaySound32 Lib "winmm.dll" Alias "sndPlaySoundA" _
    (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long

    Sub PlaySound1()
    If Application.CanPlaySounds Then
    'Substitute the path and filename of the sound you want to play
    Call sndPlaySound32("C:\Documents and Settings\Ishman\My Documents\excel\Music for Excel\MissionPossible.wav", 0)
    End If
    End Sub]

    Do I put in something like this please?

    Application.OnTime TimeValue("13:07:00"), "PlaySound1"
    Edit/Delete Message

  13. #13
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    Please take a few minutes to read the Forum Rules, and then edit your post to wrap your code with Code Tags.
    Entia non sunt multiplicanda sine necessitate

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1