Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
sub to get post code to post code mileage from web site
I am using the sub below to retrieve the distance travelled between two UK post codes, the sub inserts the post codes and triggers the calculate button on the web site fine, but the last part of the sub to retrieve the post code from the results table is way off the mark and the more I fiddle with it the more I make a holy pigs ear of it! any ideas? Private Sub 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 DoEvents Loop Do While IE.busy = True DoEvents Loop Set Form = IE.document.getElementsByTagname("Form") Set inputform = Form.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 Set Table = IE.document.getElementsByTagname("Table") Set Table = Table.Item(0) c = Table.Item(6) With Worksheets("sheet1").Range("A1") ..Value = c.Value End With IE.Quit End Sub |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
sub to get post code to post code mileage from web site
I couldn't post my reply so I took out a new posting "Atishoo" wrote: I am using the sub below to retrieve the distance travelled between two UK post codes, the sub inserts the post codes and triggers the calculate button on the web site fine, but the last part of the sub to retrieve the post code from the results table is way off the mark and the more I fiddle with it the more I make a holy pigs ear of it! any ideas? Private Sub 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 DoEvents Loop Do While IE.busy = True DoEvents Loop Set Form = IE.document.getElementsByTagname("Form") Set inputform = Form.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 Set Table = IE.document.getElementsByTagname("Table") Set Table = Table.Item(0) c = Table.Item(6) With Worksheets("sheet1").Range("A1") .Value = c.Value End With IE.Quit End Sub |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
sub to get post code to post code mileage from web site
thanks for your reply What title did you give your new posting so I can do a search on it? Thanks "Joel" wrote: I couldn't post my reply so I took out a new posting "Atishoo" wrote: I am using the sub below to retrieve the distance travelled between two UK post codes, the sub inserts the post codes and triggers the calculate button on the web site fine, but the last part of the sub to retrieve the post code from the results table is way off the mark and the more I fiddle with it the more I make a holy pigs ear of it! any ideas? Private Sub 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 DoEvents Loop Do While IE.busy = True DoEvents Loop Set Form = IE.document.getElementsByTagname("Form") Set inputform = Form.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 Set Table = IE.document.getElementsByTagname("Table") Set Table = Table.Item(0) c = Table.Item(6) With Worksheets("sheet1").Range("A1") .Value = c.Value End With IE.Quit End Sub |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
sub to get post code to post code mileage from web site
Its OK have found it! Notice stefi is interested too! thanks for that fix ta john "Joel" wrote: I couldn't post my reply so I took out a new posting "Atishoo" wrote: I am using the sub below to retrieve the distance travelled between two UK post codes, the sub inserts the post codes and triggers the calculate button on the web site fine, but the last part of the sub to retrieve the post code from the results table is way off the mark and the more I fiddle with it the more I make a holy pigs ear of it! any ideas? Private Sub 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 DoEvents Loop Do While IE.busy = True DoEvents Loop Set Form = IE.document.getElementsByTagname("Form") Set inputform = Form.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 Set Table = IE.document.getElementsByTagname("Table") Set Table = Table.Item(0) c = Table.Item(6) With Worksheets("sheet1").Range("A1") .Value = c.Value End With IE.Quit End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
split post code (zip code) out of cell that includes full address | Excel Discussion (Misc queries) | |||
post a thread via VBA code | New Users to Excel | |||
Post Code | Excel Worksheet Functions | |||
Post code lookup | Excel Worksheet Functions | |||
Post code & Suburbs | Excel Discussion (Misc queries) |