Using VBA to change market

Discussion regarding the spreadsheet functionality of Bet Angel.
Post Reply
lhy
Posts: 3
Joined: Wed Feb 16, 2011 9:28 am

Hi
I've been trying to write VBA code to switch to the next market once certain conditions within the currently open market are satisfied. The conditions are based on cells G1, C3, F3, and F4 (the time and In-play cells). Using "AppActivate" and "SendKeys" I've been able to switch focus to Bet Angel and send the keystroke "Control N" to change to the next market. The problem is that when the focus goes back to Excel the worksheet has frozen and those cells have not updated and so trigger the macro again. When the focus next returns to Excel the sheet updates fine, but is now one market ahead of where I want it to be. I tried adding a line to send the keystroke "Control P" but that still leaves me in the wrong market. I've tried using "Application.EnableEvents" without success (though I may be using it in the wrong place).

Has anyone had any success doing something like this or have any ideas?

Thanks in advance
nicrag9
Posts: 42
Joined: Sun May 16, 2010 8:02 am

Hi,
I have not tried exactly this, but it could be that your code is switching back to Excel too quickly, maybe putting in a delay would let BetANgel get finished updating itself, and then when you switched back to Excel it would be displaying the correct race. Nic
lhy
Posts: 3
Joined: Wed Feb 16, 2011 9:28 am

Thanks for that. I tried adding waits of 5 and 10 seconds after each stage. Unfortunately this didn't resolve the problem; just means you can follow it. Thanks.
nigelk
Posts: 469
Joined: Wed Apr 15, 2009 11:00 pm

It's hard to say without seeing your code.

Is it stored in a mod or as a worksheet change event? If so, what event?

Nigel.
Post Reply

Return to “Bet Angel - Spreadsheet / Excel chat”