Getting Excel to Beep

Discussion regarding the spreadsheet functionality of Bet Angel.
Post Reply
User avatar
LeTiss
Posts: 5485
Joined: Fri May 08, 2009 6:04 pm

Sometimes I'll pump a bit of liquidity into markets that are gappy, through BA's bookmaking feature.
However, I don't want to keep watching it, or keep watching Guardian, so I was hoping that I could get Excel to 'beep' when a bet has been matched

How easy is this to implement?
User avatar
to75ne
Posts: 2439
Joined: Wed Apr 22, 2009 5:37 pm

i use excel to close me out at the official off or various times after (delays etc). when it closes me out it plays a part of the 20th century fox music, as an audio reminder that it as fired.

its a function that is called when a certain time is reached. it took me some time to crack it so to speak. im no excel expert certainly not vba, but i think you could do something similar but im not sure how you would call the function, something would have to "appear" or change on the ba sheet.

but i think it can be done.
User avatar
pdupre1961
Posts: 410
Joined: Fri Feb 18, 2011 8:01 pm

LeTiss 4pm wrote:... so I was hoping that I could get Excel to 'beep' when a bet has been matched

How easy is this to implement?
Add this code into your VBA module at the top.

Code: Select all

Private Declare Function PlaySound Lib "winmm.dll" _
    Alias "PlaySoundA" (ByVal lpszName As String, _
        ByVal hModule As Long, ByVal dwFlags As Long) As Long

Sub Play_Wav_File(filename)
    Dim sWAVFile As String
    On Error GoTo Err_Play
    Call PlaySound(filename, &O0, 0)
Err_Play:
    If Err <> 0 Then
        Err.Clear
    End If
End Sub
Then, just find a ".wav" file you wish to play and store it somewhere, then put the full name (including path) in a variable - and add

Code: Select all

    Dim fullFilePath As String
    fullFilePath = "C:\Users\Paul\Bet Angel\DONUTS.wav"
    Call Play_Wav_File(fullFilePath)
Paul
User avatar
LeTiss
Posts: 5485
Joined: Fri May 08, 2009 6:04 pm

Many thanks for the responses

It works a treat Paul, cheers
User avatar
to75ne
Posts: 2439
Joined: Wed Apr 22, 2009 5:37 pm

My apologies letiss, what a useless reply. I could have sworn I pasted the code to play a wave file. I can only assume my mind wandered about trying to think how you were going to call it from your sheet, and I just forgot.

My code is very similar to pauls. Mine was totally ripped off from another site, no work at all on my part. I think paul probably knows/understands vba, as his code is slightly different and probably more efficient.

As long it does what you need it to. Once again sorry about that. :oops:
User avatar
pdupre1961
Posts: 410
Joined: Fri Feb 18, 2011 8:01 pm

to75ne wrote:My code is very similar to pauls. Mine was totally ripped off from another site, no work at all on my part. I think paul probably knows/understands vba, as his code is slightly different and probably more efficient.
No, I ripped it off as well.

:lol: Paul
buyshirts
Posts: 490
Joined: Sat Apr 18, 2009 12:37 pm

how do you get the sound to trigger when a bet is matched?
User avatar
to75ne
Posts: 2439
Joined: Wed Apr 22, 2009 5:37 pm

[/quote]

No, I ripped it off as well.

:lol: Paul[/quote]

great minds plagerise the same sites :lol:
buyshirts wrote:how do you get the sound to trigger when a bet is matched?
not sure/dont know. my one gets called as outlined below.

my sheet closes me out at some definite time ie 5 sec after official off. It greens/reds me up when cell o6 states ok.

In another cell ie cell p3 I have this formula =IF(ISBLANK(O6),"",10)

If cell o6 is empty cell p3 is empty (is blank do nothing). Once the time equals my close out time, and the green up command is fired, o6 states ok and p3 states 10 (is no longer blank so state 10).


In cell p5 I have this formula =Alarm(P3,">1")

Alarm is the function name,
If p3 is empty cell p5 states false(cell p3 is less than 1)
If p3 = 10 cell p5 states true (cell p3 is greater than 1)and calls the function named alarm, and about 3 sec of drums plays.

I hope I have explained okish how I get it to play, and hopefully it might help but, obviously cell o6 is no use to you, and im not sure what cells you would need to reference for individual bets that get matched.

You will probably need some more code as once it is fired it would need to be reset ready for the next bet that gets matched.
Post Reply

Return to “Bet Angel - Spreadsheet / Excel chat”