Community of VE/MapPoint Users and Developers
This is a discussion on Get Distance Help within the Development forums, part of the MapPoint 2006/2009 Discussion category; I need to calculate the driving distance between 2 addresses. I was wondering if anyone had a sample of VBA ...
| |||||||
| Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| Get Distance Help Thanks |
| |||
| Re: Get Distance Help
Sorry, here is the code I used. My real goal is to store the distance and travel time to field1 and field2. Private Sub cmdMap_Click() Dim oApp As Object, oMap As Object, oPush(1 To 2) As Object, oLoc(1 To 2) As Object Set oApp = CreateObject("Mappoint.Application") Set oMap = oApp.NewMap Set oLoc(1) = oMap.Find(Address & " , " & City & " , " & State) Set oLoc(2) = oMap.Find(Address2 & " , " & City2 & " , " & State2) If Not oLoc(1) Is Nothing Then Set oPush(1) = oMap.AddPushpin(oLoc(1)) oPush(1).GoTo If Not IsNull(MyName) Then oPush(1).Name = MyName oPush(1).Highlight = True If Not oLoc(2) Is Nothing Then Set oPush(2) = oMap.AddPushpin(oLoc(2)) oPush(2).Highlight = True With oMap.ActiveRoute .Waypoints.Add oLoc(1) .Waypoints.Add oLoc(2) .Calculate End With oMap.CopyDirections txtDir.SetFocus RunCommand acCmdPaste Else txtDir.SetFocus txtDir.Text = "No second location found!" End If oMap.DataSets(1).ZoomTo oMap.CopyMap imgClip.Visible = True imgClip.Action = acOLEPaste lblMapInfo.Caption = "" Else lblMapInfo.Caption = "Address Not Found!" End If Set oMap = Nothing Set oApp = Nothing Me.SetFocus End Sub |
| ||||
| Re: Get Distance Help
hi, Quote:
Travel Time depends on your Drive Profile e.g. Speed. use TripTime property (Route) to get Travel Time.
__________________ greetings by OHR Jimmy |
![]() |
| Tags |
| distance |
| ||||
| Posted By | For | Type | Date | |
| MapPoint Download - MP2K Magazine | This thread | Refback | 12-02-2008 12:29 AM | |
| Formatting coordinates with DmsFormat, linking to weather data, three new utilities - MP2K Update Archives - MP2K Magazine | This thread | Refback | 11-28-2008 10:22 AM | |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Minimum Distance | JDells | MapPoint Web Service and Virtual Earth | 0 | 06-05-2007 03:12 PM |
| mappoint distance | cptkirkh | MapPoint 2006/2009 Discussion | 1 | 01-31-2007 01:24 PM |
| distance | Anonymous | MapPoint 2006/2009 Discussion | 0 | 02-11-2004 01:03 PM |
| Distance from Polygon | random0000 | MapPoint 2006/2009 Discussion | 1 | 04-14-2003 10:18 PM |
| distance | Anonymous | MapPoint 2006/2009 Discussion | 1 | 11-22-2002 03:09 PM |