Driving Distance Between 2 Zip Codes.
I'm trying to create a macro in Excel to import the
driving distance between 2 zip codes from MapPoint 2006. Any suggestions?
This is a discussion on ArtS within the MapPoint Desktop Discussion forums, part of the Map Forums category; Driving Distance Between 2 Zip Codes. I'm trying to create a macro in Excel to import the driving distance between ...
Driving Distance Between 2 Zip Codes.
I'm trying to create a macro in Excel to import the
driving distance between 2 zip codes from MapPoint 2006. Any suggestions?
Check out this thread and example code, it should be enough to get you started.
Also, see the example code at Working With Excel and MapPoint - MP2K Magazine
Eric
Eric,
Thank you so much! I finally got it working & it's working great.
I had to make some minor modifications. This is the exact code I used:
----------------------------------------------------------------------Code:Dim oApp As MapPoint.Application Private Sub CalculateDrivingDistance() Set oApp = CreateObject("MapPoint.Application.NA.13") oApp.Visible = True Set objMap = oApp.NewMap Set objRoute = objMap.ActiveRoute szZip1 = Worksheets("Sheet1").Cells(2, 1) szZip2 = Worksheets("Sheet1").Cells(2, 2) 'Add route stops and calculate the route objRoute.Waypoints.Add objMap.FindResults(szZip1).Item(1) objRoute.Waypoints.Add objMap.FindResults(szZip2).Item(1) objRoute.Calculate Worksheets("Sheet1").Cells(2, 3) = objRoute.Distance End Sub
Now I'm trying to tweek it some more.
How would I add in the driving time
& how could I make MapPoint go to the back automatically so I only see the Excel spread sheet?
Thanks Again!
Sincerely,
Art
Just comment out this line or change it to false!
Code:oApp.Visible = True
There are currently 1 users browsing this thread. (0 members and 1 guests)