View Single Post

  #2 (permalink)  
Old 09-19-2001
Anonymous Anonymous is offline
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
This can be done quite easily. The code needed to extract distances is actually in the MapPoint 2002 Programming Reference, under the Distance Property section.

Here is the code:<form><textarea wrap="off" readonly="true" name="code" style="BORDER-BOTTOM: gray 1px inset; BORDER-LEFT: gray 1px inset; BORDER-RIGHT: gray 1px inset; BORDER-TOP: gray 1px inset; OVERFLOW: auto; WIDTH: 100%" rows="25" cols="40">Sub TotalRouteDistance()


Dim objApp As New MapPoint.Application
Dim objMap As MapPoint.Map
Dim objRoute As MapPoint.Route


'Set up application
Set objMap = objApp.ActiveMap
Set objRoute = objMap.ActiveRoute
objApp.Visible = True
objApp.UserControl = True


'Add route stops and calculate the route
objRoute.Waypoints.Add objMap.FindResults("Seattle, WA").Item(1)
objRoute.Waypoints.Add objMap.FindResults("Redmond, WA").Item(1)
objRoute.Calculate


'Output the total length of the route
MsgBox "The route distance is: " + CStr(objRoute.Distance)

End Sub
</textarea>
</form>

You can find the Programming Reference on http://msdn.microsoft.com/mappoint or in MapPoint 2002's Help.



This code then needs to be extended to save all calculated distances in an Excel workbook. Again, this is a simple programming task.
Reply With Quote