tweedle
Well-known Member
- Joined
- Aug 1, 2010
- Messages
- 1,559
Hi, would appreciate some assistance on this one.
So we have HTMLtables with Col labels and Row Labels and values at the intersects.
For each intersect cell, I need to collect the Column Title, Row Label and data value (in the intersection).
[Can collect to an array]
Here's what I have so far [less the miserable failures]
From http://www.clrsearch.com/Raleigh_Demographics/NC/27610/
This is one of many tables to collect.
Thoughts?
Am I on the best path?
So we have HTMLtables with Col labels and Row Labels and values at the intersects.
For each intersect cell, I need to collect the Column Title, Row Label and data value (in the intersection).
[Can collect to an array]
Here's what I have so far [less the miserable failures]
Code:
Option Compare Database
Sub CollectCLSearchDemographics()
Dim IEDoc As HTMLDocument
Dim tbl As HTMLTable
'http://msdn.microsoft.com/en-us/library/aa752084(v=vs.85).aspx
rootURL = "[URL]http://www.clrsearch.com/[/URL]"
midURL = "Raleigh_Demographics/"
endURL = "NC/27610/"
fullURL = rootURL & midURL & endURL
Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = True
ie.Navigate fullURL
Do While ie.busy
DoEvents
Loop
Set IEDoc = ie.document
With IEDoc
Set tbl = ie.document.getElementById("tab-crime")
'Errors - object variable not set
'Debug.Print tbl.cells.Item(Index:=1)
For Each ele In ie.document.getElementsByTagName("table"): i = i + 1: Next
MsgBox i 'Reports 33 Tables
End With
Exit Sub
ie.Quit
End Sub
From http://www.clrsearch.com/Raleigh_Demographics/NC/27610/
This is one of many tables to collect.
HTML:
2010 Crime Rate Indexes
Raleigh, NC 27610
North Carolina
United States
Total Crime Risk Index
90
115
100
Murder Risk Index
89
107
100
Rape Risk Index
66
87
100
Robbery Risk Index
77
93
100
Assault Risk Index
49
88
100
Burglary Risk Index
84
160
100
Larceny Risk Index
127
110
100
Motor Vehicle Theft Risk Index
70
86
100
Thoughts?
Am I on the best path?
Last edited: