Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 267
Default Mileage Calculator by post code / zip code

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Mileage Calculator by post code / zip code


Atishoo;544679 Wrote:

I made a number of improvements to youir code

1) Only open the IE explorer once in the code and close it once. It is
quicker when you are looping athrough a lot of data

2) the Do event Loop : Combine the IE.readyState and IE.Busy into one
loop. I find at different website one becomes busy before the other but
it is not predicatable which becomes ready first.

3) I included a Dump routine so you can see the actual data. In sheet
you will see there are 10 tables (Do a find all on column A). You will
see the data you are looking for in cell D134. The webpage arrays start
at 0 (zero) so table 9 will be table.item(8). The rows and columns also
start at zero so you want to return row(5) : column(1).

Private Sub CommandButton1_Click()

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

For Each c In Worksheets("Sheet1").Range("D6:N6").Cells
If c.Offset(0, 1).Value < "" Then


URL =
"http://www.driving-distances.com/distances-between-calculator.php"
IE.Navigate2 URL
Do While IE.readyState < 4 Or _
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.readyState < 4 Or _
IE.busy = True

DoEvents
Loop
Call Dump(IE)
Set Table = IE.document.getElementsByTagname("table")
Set DistanceTable = Table.Item(8)

Set DistanceRow = DistanceTable.Rows(4)

c.Offset(1, 1) = Val(Trim(DistanceRow.Cells(1).innertext))

End If
Next

IE.Quit

End Sub

Sub Dump(IE)

With Sheets("sheet2")
Cells.ClearContents
RowCount = 1
For Each itm In IE.document.all
Range("A" & RowCount) = itm.Tagname
Range("B" & RowCount) = itm.classname
Range("C" & RowCount) = itm.ID
Range("D" & RowCount) = Left(itm.innertext, 1024)
RowCount = RowCount + 1
Next itm
End With
End Sub


--
joel
------------------------------------------------------------------------
joel's Profile: http://www.thecodecage.com/forumz/member.php?userid=229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=149872

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Mileage Calculator by post code / zip code

Hi,

I can't get a reference to the table either but can cheat. This will
populate the 4 cells below the postcode with the 4 distances the web page
calculates. I hope someone comes up with a less messy solution for you

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
RowCount = 1
For Each itm In IE.document.all
If Val(itm.innertext) < 0 Then
c.Offset(RowCount, 1) = itm.innertext
RowCount = RowCount + 1
End If
Next itm
IE.Quit
End If
Next
End Sub

Mike

"Atishoo" wrote:

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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Mileage Calculator by post code / zip code


Formula:
--------------------
What is the problem! See my code. try my dump and you will get a better understand of how the page is laid out.
--------------------


--
joel
------------------------------------------------------------------------
joel's Profile: http://www.thecodecage.com/forumz/member.php?userid=229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=149872

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Mileage Calculator by post code / zip code


Glad i could help but you must be able to refer to the table instead of
everyting on the web page, I just don't know how to do it.

Mike

"Atishoo" wrote:

Thanks Mike, been struglin with that for ages!

"Mike H" wrote:

Hi,

I can't get a reference to the table either but can cheat. This will
populate the 4 cells below the postcode with the 4 distances the web page
calculates. I hope someone comes up with a less messy solution for you

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
RowCount = 1
For Each itm In IE.document.all
If Val(itm.innertext) < 0 Then
c.Offset(RowCount, 1) = itm.innertext
RowCount = RowCount + 1
End If
Next itm
IE.Quit
End If
Next
End Sub

Mike

"Atishoo" wrote:

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



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 267
Default Mileage Calculator by post code / zip code

Yeah me neither and there is not an awful lot on the net regarding this that
I can find.
i am also trying a third variant using another web site:
http://www.freemaptools.com/distance...-postcodes.htm
this one is better but it has so much data on it its hard to sift out the
results!

"Mike H" wrote:


Glad i could help but you must be able to refer to the table instead of
everyting on the web page, I just don't know how to do it.

Mike

"Atishoo" wrote:

Thanks Mike, been struglin with that for ages!

"Mike H" wrote:

Hi,

I can't get a reference to the table either but can cheat. This will
populate the 4 cells below the postcode with the 4 distances the web page
calculates. I hope someone comes up with a less messy solution for you

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
RowCount = 1
For Each itm In IE.document.all
If Val(itm.innertext) < 0 Then
c.Offset(RowCount, 1) = itm.innertext
RowCount = RowCount + 1
End If
Next itm
IE.Quit
End If
Next
End Sub

Mike

"Atishoo" wrote:

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

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 267
Default Mileage Calculator by post code / zip code

Thanks Mike, been struglin with that for ages!

"Mike H" wrote:

Hi,

I can't get a reference to the table either but can cheat. This will
populate the 4 cells below the postcode with the 4 distances the web page
calculates. I hope someone comes up with a less messy solution for you

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
RowCount = 1
For Each itm In IE.document.all
If Val(itm.innertext) < 0 Then
c.Offset(RowCount, 1) = itm.innertext
RowCount = RowCount + 1
End If
Next itm
IE.Quit
End If
Next
End Sub

Mike

"Atishoo" wrote:

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

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 279
Default Mileage Calculator by post code / zip code

In message of Sun, 1 Nov 2009 12:09:36 in
microsoft.public.excel.programming, joel
writes

Atishoo;544679 Wrote:

I made a number of improvements to youir code


If I read enough of joel's contributions, I should get as much knowledge
of Internet Explorer's Document Object Model as I want to automate
website interaction.

[snip]

3) I included a Dump routine so you can see the actual data. In sheet
you will see there are 10 tables (Do a find all on column A). You will
see the data you are looking for in cell D134. The webpage arrays start
at 0 (zero) so table 9 will be table.item(8). The rows and columns also
start at zero so you want to return row(5) : column(1).

Private Sub CommandButton1_Click()


[snip]

End Sub

Sub Dump(IE)

With Sheets("sheet2")
Cells.ClearContents
RowCount = 1
For Each itm In IE.document.all
Range("A" & RowCount) = itm.Tagname
Range("B" & RowCount) = itm.classname
Range("C" & RowCount) = itm.ID
Range("D" & RowCount) = Left(itm.innertext, 1024)
RowCount = RowCount + 1
Next itm
End With
End Sub



I think joel forgot some periods!
The code splats Sheet1 with Microsoft Excel 2002 (10.2614.2625). (I
don't have immediate access to 2003 to test compatibility.) I found the
following code worked better by writing to sheet2:

Sub Dump(IE)

With Sheets("sheet2")
..Cells.ClearContents
RowCount = 1
For Each itm In IE.document.all
..Range("A" & RowCount) = itm.Tagname
..Range("B" & RowCount) = itm.classname
.. Range("C" & RowCount) = itm.ID
.. Range("D" & RowCount) = Left(itm.innertext, 1024)
RowCount = RowCount + 1
Next itm
End With
End Sub

I am in want of a generic DOM dump which will do a full job.
I reckon such a utility should simplify page analysis.
I await delivery of a Mozilla book to reduce my ignorance. ;)
--
Walter Briscoe
  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Mileage Calculator by post code / zip code


Walter Briscoe;544872 Wrote:

Formula:
--------------------

The single period works on excel 2003, not sure why you ned two periods in 2007.

The Dump Subroutine is using sheet 2 and will give an error if you don't have sheet 2 in the workkbook.

IE versons 7 and 8 has a good developers tool by pressing F12.


Your table reference isn't working because the index to arrays start at 0 not one. The table is two columns with each column being cells(0), and cells(1). You have cells(2) which produces the error.
--------------------


--
joel
------------------------------------------------------------------------
joel's Profile: http://www.thecodecage.com/forumz/member.php?userid=229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=149872

  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Mileage Calculator by post code / zip code

Hi Joel,

Looks like a typo or error in posting, as Walter mentioned -

Sub Dump(IE)

With Sheets("sheet2")
Cells.ClearContents ' << needs a dot to qualify to With
RowCount = 1
For Each itm In IE.document.all
Range("A" & RowCount) = itm.Tagname ' << needs a dot to qualify to With

..Cells.ClearContents
RowCount = 1
..Range("A" & RowCount) = itm.Tagname
etc

might be an idea to declare the variables

Regards,
Peter T



"joel" wrote in message
...

Walter Briscoe;544872 Wrote:

Formula:
--------------------

The single period works on excel 2003, not sure why you ned two periods
in 2007.

The Dump Subroutine is using sheet 2 and will give an error if you don't
have sheet 2 in the workkbook.

IE versons 7 and 8 has a good developers tool by pressing F12.


Your table reference isn't working because the index to arrays start at 0
not one. The table is two columns with each column being cells(0), and
cells(1). You have cells(2) which produces the error.
--------------------


--
joel
------------------------------------------------------------------------
joel's Profile: http://www.thecodecage.com/forumz/member.php?userid=229
View this thread:
http://www.thecodecage.com/forumz/sh...d.php?t=149872





  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Mileage Calculator by post code / zip code

Hmm, seems like NNTP posts are not being propagated to Microsoft's
Communities, aka "WebNews", again!

IOW it's unlikely Atishoo and Mike H will see NNTP replies by Joel, Walter
and myself. Maybe these posts will get through in the next few days.

Regards,
Peter T


"Peter T" <peter_t@discussions wrote in message
...
Hi Joel,

Looks like a typo or error in posting, as Walter mentioned -

Sub Dump(IE)

With Sheets("sheet2")
Cells.ClearContents ' << needs a dot to qualify to With
RowCount = 1
For Each itm In IE.document.all
Range("A" & RowCount) = itm.Tagname ' << needs a dot to qualify to With

.Cells.ClearContents
RowCount = 1
.Range("A" & RowCount) = itm.Tagname
etc

might be an idea to declare the variables

Regards,
Peter T



"joel" wrote in message
...

Walter Briscoe;544872 Wrote:

Formula:
--------------------

The single period works on excel 2003, not sure why you ned two periods
in 2007.

The Dump Subroutine is using sheet 2 and will give an error if you don't
have sheet 2 in the workkbook.

IE versons 7 and 8 has a good developers tool by pressing F12.


Your table reference isn't working because the index to arrays start at
0 not one. The table is two columns with each column being cells(0), and
cells(1). You have cells(2) which produces the error.
--------------------


--
joel
------------------------------------------------------------------------
joel's Profile: http://www.thecodecage.com/forumz/member.php?userid=229
View this thread:
http://www.thecodecage.com/forumz/sh...d.php?t=149872





  #12   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Mileage Calculator by post code / zip code

Hi,

I can see Joel's post and note the much improved version on that I used. As
I said in my response to the OP I knew my code wasn't good and am pleased
Joel has shown us how to do it properly.

Mike

"Peter T" wrote:

Hmm, seems like NNTP posts are not being propagated to Microsoft's
Communities, aka "WebNews", again!

IOW it's unlikely Atishoo and Mike H will see NNTP replies by Joel, Walter
and myself. Maybe these posts will get through in the next few days.

Regards,
Peter T


"Peter T" <peter_t@discussions wrote in message
...
Hi Joel,

Looks like a typo or error in posting, as Walter mentioned -

Sub Dump(IE)

With Sheets("sheet2")
Cells.ClearContents ' << needs a dot to qualify to With
RowCount = 1
For Each itm In IE.document.all
Range("A" & RowCount) = itm.Tagname ' << needs a dot to qualify to With

.Cells.ClearContents
RowCount = 1
.Range("A" & RowCount) = itm.Tagname
etc

might be an idea to declare the variables

Regards,
Peter T



"joel" wrote in message
...

Walter Briscoe;544872 Wrote:

Formula:
--------------------

The single period works on excel 2003, not sure why you ned two periods
in 2007.

The Dump Subroutine is using sheet 2 and will give an error if you don't
have sheet 2 in the workkbook.

IE versons 7 and 8 has a good developers tool by pressing F12.


Your table reference isn't working because the index to arrays start at
0 not one. The table is two columns with each column being cells(0), and
cells(1). You have cells(2) which produces the error.
--------------------


--
joel
------------------------------------------------------------------------
joel's Profile: http://www.thecodecage.com/forumz/member.php?userid=229
View this thread:
http://www.thecodecage.com/forumz/sh...d.php?t=149872





.

  #13   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Mileage Calculator by post code / zip code

Thanks Joel

"joel" wrote:


Formula:
--------------------
What is the problem! See my code. try my dump and you will get a better understand of how the page is laid out.
--------------------


--
joel
------------------------------------------------------------------------
joel's Profile: http://www.thecodecage.com/forumz/member.php?userid=229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=149872

.

  #14   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 897
Default Mileage Calculator by post code / zip code

FYI it looks like MapQuest has an XML API that you can use for driving
directions. With a bit of programming you can avoid the IE object
model altogether.

http://devblog.mapquest.com/2009/07/...not-the-moon/#

--JP

On Nov 1, 4:59*am, Atishoo wrote:
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.

  #15   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Mileage Calculator by post code / zip code


You can convert any IE application to an XML application. There is
really no difference except the IE has visual data that takes longer to
download. they both use exactly the same URL.


--
joel
------------------------------------------------------------------------
joel's Profile: http://www.thecodecage.com/forumz/member.php?userid=229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=149872

Microsoft Office Help



  #16   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 897
Default Mileage Calculator by post code / zip code

Web APIs are optimized to return results, without the overhead of the
visual elements that HTML produces. If you can find a site that offers
one, the advantages are greater than you suggest. The code is much
shorter, and executes faster. And in most cases, there is a specific
interface provided at a custom URL, whereas IE automation simply
mimicks what a user would do when visiting the "public" page provided
by a web service.

--JP

On Nov 2, 12:44*pm, joel wrote:
You can convert any IE application to an XML application. *There is
really no difference except the IE has visual data that takes longer to
download. *they both use exactly the same URL.

--
joel

  #17   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 267
Default Mileage Calculator by post code / zip code

Thanks Joel
And thanks for the links have applied the same principles to spread sheets
using web pages providing costs benefits analysis, in place of web queeries
with much better effect.

"joel" wrote:


You can convert any IE application to an XML application. There is
really no difference except the IE has visual data that takes longer to
download. they both use exactly the same URL.


--
joel
------------------------------------------------------------------------
joel's Profile: http://www.thecodecage.com/forumz/member.php?userid=229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=149872

Microsoft Office Help

.

Reply
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
split post code (zip code) out of cell that includes full address Concord Excel Discussion (Misc queries) 4 October 15th 09 06:59 PM
sub to get post code to post code mileage from web site Atishoo Excel Programming 3 June 29th 09 02:12 PM
Post Code Adam Excel Worksheet Functions 2 September 6th 07 04:12 PM
Mileage calculator workbook Ruben Torrez Excel Discussion (Misc queries) 2 January 11th 07 04:15 PM
Mileage calculator in EXCEL Wes Lucas Excel Worksheet Functions 3 December 12th 05 01:37 PM


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

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

About Us

"It's about Microsoft Excel"