Can Excel VBA search for and read URL

D

Dirk Nachbar

I want Excel to import data from the website
http://neighbourhood.statistics.gov.uk/dissemination/ for given
postcodes, unfortunately it only works if you physically type in the
postcode on the web, as putting the postcode into the PHP style URL
doesn't work. Is Excel able to do that?

Basically I want something like this
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://neighbourhood.statistics.gov.uk/dissemination/
LeadKeyFigures.do?a=3&b=5939933&c=" & Cells(i, 17) &
"&d=14&e=16&g=409939&i=1001x1003x1004&m=0&enc=1"


Dirk
 
D

Don Guillett

this seemed to work when I recorded changing the original screen. I'm US so
don't understand UK postcodes.
Sub Macro1()
'
' Macro1 Macro
' Macro recorded 7/20/2007 by Donald B. Guillett
'

'
Range("A5").Select
With Selection.QueryTable
.Connection = _
"URL;http://neighbourhood.statistics.gov.uk/dissemination/LeadAreaSearch.do?a=3&c="
& Cells(3, 1) & "&i=1001&m=0&enc=1&areaSearchText=" & Cells(3, 1) &
"&areaSearchType=13&extendedList=false&searchAreas=Search"
.WebSelectionType = xlEntirePage
.WebFormatting = xlWebFormattingRTF
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
End Sub
 
D

Dirk Nachbar

Sorry I should have been more clear, it does work mechanically, but it
doesn't pick up the right area, the area is bascially determined by
b=5939933.

Dirk
 
D

Don Guillett

Since I am not familiar with UK numbers and you can't explain it to
me,perhaps someone else can help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top