Forums

General Betting

Welcome to Live View – Take the tour to learn more
Start Tour
There is currently 1 person viewing this thread.
yeahyeahwhatever
19 Jul 12 16:11
Joined:
Date Joined: 27 Sep 03
| Topic/replies: 9,750 | Blogger: yeahyeahwhatever's blog
Hi, I have VBA code that's been working fine for years - it pulls odds from oddschecker using a web query.  An example url would be
http://www.oddschecker.com/horse-racing-betting/brighton/16%3A45
(Obviously %3A in place of : colon). 

If I take the above url and paste it into a browser, it loads just fine. 

If I run a manual web query and paste above url, it loads and pastes just fine.

If I call it through VBA I get the dreaded 1004 error.

To try and fix it I have tried:
1. Manual and inetcpl.cpl reset of IE
2. Login/no login into oddschecker before running web query
3. Recording macro during which time I do manual web query - then dumping that code into new .xlsm.  Returns 1004 error. Not a priv problem, other urls run just fine.

In order that I don't lose my last shred of sanity please don't suggest that I check the forums or post for help.  Amazingly that thought has already occurred to me (yep, get quite sarcastic when frustrated).

Could it be a f*cking flash ad/totally unnecessary whizzy add-in show off piece of crap... more than likely.  Yes, I know I could stick an IE control on a UF and parse the source with DOM, but this is straightforward code and it's been working for years, so why not today!

[and deep breath]

thanks
Pause • Switch to Standard View Help please, 1004 error on web query
Show More
Loading...
Report JLivermore • July 19, 2012 4:24 PM BST
Do you think they changed their site?  Have you made any updates to your system?  Does VBA call http://www.oddschecker.com ok?
Report yeahyeahwhatever • July 19, 2012 4:56 PM BST
I can't see any obvious changes to their site, I've made no updates.  http://www.oddschecker.com loads and pastes just fine.

It was working this morning, then I had a few sporadic errors... now it's just ground to a halt.  I know it's easy to blame the colon (and would it have killed you to use an underscore oddschecker.. would it!) but they made that change a while ago and it didn't cause any problems.

The fact it's only just started playing up (I've rebooted, unzipped for clean files etc) makes me think it's a flash ad... I LOATHE them with a passion.  Half the time they don't trigger readystatecomplete events... they waste bandwith and processing power.  No purpose whatsoever.

[and time to breathe ....] Plain

Parsing the source it is then, at least I'll have navigate2 figure out when the page does finish loading instead of going around and around in flash-ad-land.

Thanks for replying. not having a day as you might have guessed Happy
Report JLivermore • July 19, 2012 5:26 PM BST
no worries.

Sounds from your intermittent symptoms like you're on the right track.  I've never had to deal with flash ads and don't use VBA for this kind of stuff so sorry couldn't be more help.
Report Compound Magic • July 19, 2012 5:27 PM BST
Hi yeahyeahwhatever,

The 1004 error is most likely because the data copied from the site is now filtered.

It is a paste error and usually only occurs when copied data is filtered and you then try to paste it.

I haven't the time to look it all up but there are some workarounds like pasting rows separately.

Try googling for an answer.
Report yeahyeahwhatever • July 19, 2012 5:43 PM BST
CM - you've lost me on "the data copied from the site is now filtered".  I'm not passing in any params with the url, it's a distinct address.
Report yeahyeahwhatever • July 19, 2012 5:52 PM BST
CM, just googled and a 1004 error can result when you copy filtered data from worksheet to worksheet.

I'm copying from webpage to worksheet though.
Report Compound Magic • July 19, 2012 6:12 PM BST
I just checked out the site and it is coming up with a script error but is still loading onto my excel 2007

When you do a web query it copies the data with the yellow arrows and pastes it into excel, it works differently when putting the data in a browser.

If the data in the web query is filtered and it copies that data, then tries to paste it in excel that is when the 1004 occurs.

If the data is not filtered and still comes up with 1004 it could be the script error causing the problem.
As you are calling via a VBA module, I cannot trace the error as I don't have the module.

It is late here in Oz and I'm of to bed. Will check in tomorrow to see how you fared.
Report Compound Magic • July 19, 2012 6:54 PM BST
Got in bed and the idea came to me that you probably don't have an error trap routine in your VBA.

When you do it manually it comes up with a script error and "Do you want to continue anyway" I clicked yes and it loaded. If a VBA module struck that without a error trapping routine it could not continue so threw up the 1004.

Hope that helps. The next time you try it may work fine as the script error may be fixed.

I suggest you put in your calling module an error trapping sub routine.

Cheers.
Report yeahyeahwhatever • July 19, 2012 6:57 PM BST
CM, you're going down the wrong path with this "filtered data" approach.  The data pulled from the data isn't filtered.  I know many 1004 help pages on the net refer to filtered data but that's because they're talking about worksheet to worksheet copying.  I appreciate it's the same error#, but knowing a potential solution for filtered data from ws to ws isn't transferable here.


I don't get any script errors - and I've tried FF/Chrome/Opera/IE7&8.
If you want the module code, just record a macro, and run a webquery.

thanks anyway.
Report yeahyeahwhatever • July 19, 2012 6:59 PM BST
re: you probably don't have an error trap routine in your VBA.


you know what, after 25 years of coding... I do.  Have a good sleep.
Report yeahyeahwhatever • July 20, 2012 12:34 AM BST
After a lot more reading it seems as though Office triggers a 1004 error when it can't complete a paste - often down to insufficient pagefiles/clipboard.  Now there are times when I think oddschecker's main aim in life is to stick as many controls on its site as possible, and if I was on a machine with minimum page files and low RAM I could, possibly, accept that I ran into memory problems... but this afternoon I took over most of the machines in the office and even when I was on a souped-up i7, 64bit Windows with 32gb memory I was still having problems. I can't believe I filled the (very generous) page files/clipboard on that.

What I think has happened is that because there was a "special offer" control on the pages I wanted, I think that was, possibly, returning a false positive for EOF, endOfControl, whatever and causing the paste to fail. After all, I could load and paste www.oddschecker.com without problem, it was only when I went to individual race pages that I saw an error.

oh well, the upshot of this is that it made me drag that ancient webquery sub into the 21st century and now it's a new, clean parse of the source using the DOM.

I'm off to bed.
Thanks for your replies.
Post Your Reply
<CTRL+Enter> to submit
Please login to post a reply.

Wonder

Instance ID: 13539
www.betfair.com