LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Request for Postal Codes


This request disappeared from the postings. do'nt know why. Here is the
solution

Sub Private Commandbutton1_Click()

Postcode = InputBox("Enter PostCode: ")

Postcode2 = InputBox("Enter 2nd PostCode: ")


Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True

URL = _
"http://www.postcode.org.uk/country/uk/_postcode-distance-calculator.asp"
IE.Navigate2 URL

Do While IE.readyState < 4 Or IE.busy = True
DoEvents
Loop

Set MyForm = IE.document.getElementsByTagname("Form")
Set inputform = MyForm.Item(0)

Set Postcodebox = inputform.Item(0)
Postcodebox.Value = Postcode

Set Postcodebox2 = inputform.Item(1)
Postcodebox2.Value = Postcode2

Set POSTCODEbutton = inputform.Item(2)
POSTCODEbutton.Click

Do While IE.readyState < 4 Or IE.busy = True
DoEvents
Loop


Set Table = IE.document.getElementsByTagname("Table")
Set DistanceTable = Table.Item(3)

Set DistanceRow = DistanceTable.Rows(2)
distance = Val(Trim(DistanceRow.Cells(2).innertext))
With Worksheets("sheet1")
.Range("A1").Value = distance
End With

IE.Quit
End Sub

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Postal codes Karin Excel Discussion (Misc queries) 4 April 19th 08 05:43 PM
international postal codes JJ Johnson Excel Worksheet Functions 3 November 10th 07 03:23 PM
formula for Canadian Postal Codes LB Excel Worksheet Functions 6 January 25th 07 06:30 PM
UK Postal codes in Excel Paul G Excel Worksheet Functions 6 October 30th 06 12:07 PM
Distances between Postal Codes Irfan Excel Discussion (Misc queries) 1 May 31st 06 10:49 PM


All times are GMT +1. The time now is 04:08 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"