elements of a page

Please post any questions regarding the program here.

Moderator: 2020vision

elements of a page

Postby alrodopial » Sun Feb 27, 2011 10:41 am

I show sometime ago a piece of vba code for extracting the elements of a page and it's contents.
It was a simple code that extracts in column A the element's name, in column B the elements id's ,in column C ???, in column D the inner text.
If i remember correctly there were 4 columns used, 4 pieces of info were extracted.
Can someone provide or create something similar?

The code was similar with the below:

Code: Select all
Sub GetAllTables(D)
For Each E In D.all
    If E.nodename = "TABLE" Then
        Set t = E
   
        tabno = tabno + 1
        nextrow = nextrow + 1
       
        Set Rng = Range("B" & nextrow)
        Rng.Offset(, -1) = "Table " & tabno
       
        For Each r In t.Rows
           
            For Each c In r.Cells
                Rng.Value = c.innerHTML
                Set Rng = Rng.Offset(, 1)
                I = I + 1
            Next c
           
            nextrow = nextrow + 1
           
            Set Rng = Rng.Offset(1, -I)
           
            I = 0
           
        Next r
    End If
Next E

End Sub
alrodopial
 
Posts: 1384
Joined: Wed Dec 06, 2006 9:59 pm

Postby alrodopial » Sun Feb 27, 2011 10:48 am

Found it:

Code: Select all
Sub DownloadBasicINFO()
   
   
    Set IE = CreateObject("InternetExplorer.Application")
    IE.Visible = True
   
    CurrentHorsePreviusResultsURL = "http://www.racingpost.com/horses/horse_form.sd?horse_id=730819"
    IE.Navigate CurrentHorsePreviusResultsURL
    Do While IE.Busy Or IE.ReadyState <> 4: DoEvents: Loop
   
    Set basic = IE.document
   
    Sheets("temp").Select
    j = 0
    For I = 0 To basic.all.Length - 1
    'If basic.all(i).className = "smlCardBg" Then
    j = j + 1
    Cells(j, 1).Value = basic.all(I).innerTEXT
    Cells(j, 2).Value = basic.all(I).ID
    Cells(j, 3).Value = TypeName(basic.all(I))
    Cells(j, 4).Value = basic.all(I).className
    'End If
    Next I
   
    'ie.Quit
   
    End Sub
alrodopial
 
Posts: 1384
Joined: Wed Dec 06, 2006 9:59 pm


Return to Help

Who is online

Users browsing this forum: No registered users and 46 guests

Sports betting software from Gruss Software


The strength of Gruss Software is that it’s been designed by one of you, a frustrated sports punter, and then developed by listening to dozens of like-minded enthusiasts.

Gruss is owned and run by brothers Gary and Mark Russell. Gary discovered Betfair in 2004 and soon realised that using bespoke software to place bets was much more efficient than merely placing them through the website.

Gary built his own software and then enhanced its features after trialling it through other Betfair users and reacting to their improvement ideas, something that still happens today.

He started making a small monthly charge so he could work on it full-time and then recruited Mark to help develop the products and Gruss Software was born.

We think it’s the best of its kind and so do a lot of our customers. But you can never stand still in this game and we’ll continue to improve the software if any more great ideas emerge.