View Single Post
 
Old 10-04-2013, 03:16 PM
BobBridges's Avatar
BobBridges BobBridges is offline Windows 7 64bit Office 2010 32bit
Expert
 
Join Date: May 2013
Location: USA
Posts: 700
BobBridges has a spectacular aura aboutBobBridges has a spectacular aura about
Default

I've done this before, Catalin, and it's complicated. Actually it isn't the VBA code that's complicated, but navigating your way through other people's web pages usually is.

Internally, a web page is a mass of objects containing objects containing objects. A very ordinary web page can contain thousands of objects to 15 or 20 levels, and figuring out how they're organized take much more effort as a programmer than just finding the red button with your eyes once it's displayed—so much more effort that I eventually wrote an Excel routine to "map" a web page's object tree so that I can easily (fairly easily) find the ones I'm interested in and figure out how to get to them in an Excel program....

---

I wrote the above this morning. Next I was going to say "I ran that utility on your racing page, and I've attached a map of the various nodes so you can see how it's set up". But this is the first time I've run this particular VBA program since I switched to my new computer, and it's failing at the point where it tries to recurse through the various ChildNodes in the Document object. My program navigates correctly to the URL, and it's reading the page alright—at least I can see it in IE. But although my program can see that there are objects in the Document object, the object Watch window claims that there are "No Variables" in the Document. I spent some time fooling around with it, but so far I don't see what's I'm doing wrong. Naturally I suspect it's because I have to do something different with the new object either under Window 7 or (more likely) IE 10, but so far I haven't found the right combination of search terms to google the solution.

You can always read the raw HTML code of a page (at least I used to be able to; I hope I still can ), but to push the button you need the DOM, the Document Object Model. I'll keep looking, and after all it may work for you. The object type in VBA is "SHDocVw.InternetExplorer", if you don't mind googling for it; and there's an interesting looking article at http://support.microsoft.com/kb/176792 that talks about how to connect to an instance of IE that's already running, which may help too. Meanwhile I'll have to figure out what changed before I can help anyone else with it.
Reply With Quote