Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
I am adapting the following sub to work with a more accurate web site (one that calculates distances based on the full post code) I am getting object variable / block variable not set on the last line: c.Offset(1, 1) = Val(Trim(DistanceRow.Cells(2).innertext)). Am i referencing the IE table incorectly? Any ideas apreciated. Private Sub CommandButton1_Click() For Each c In Worksheets("Sheet1").Range("D6:N6").Cells If c.Offset(0, 1).Value < "" Then Set IE = CreateObject("InternetExplorer.Application") IE.Visible = True URL = "http://www.driving-distances.com/distances-between-calculator.php" 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 = c.Value Set Postcodebox2 = inputform.Item(1) Postcodebox2.Value = c.Offset(0, 1).Value Set POSTCODEbutton = inputform.Item(2) POSTCODEbutton.Click Do While IE.busy = True Loop Set Table = IE.document.getElementsByTagname("table") Set DistanceTable = Table.Item(1) Set DistanceRow = DistanceTable.Rows(6) c.Offset(1, 1) = Val(Trim(DistanceRow.Cells(2).innertext)) IE.Quit End If Next End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
split post code (zip code) out of cell that includes full address | Excel Discussion (Misc queries) | |||
sub to get post code to post code mileage from web site | Excel Programming | |||
Post Code | Excel Worksheet Functions | |||
Mileage calculator workbook | Excel Discussion (Misc queries) | |||
Mileage calculator in EXCEL | Excel Worksheet Functions |