Welcome to MapForums!

Register, sign in, or use Facebook Connect above to join in and participate in the forum.

When you are signed in, this message, the ads in this row, and the red-underlined link ads all go away.

Subscribe to receive our newsletter.
Subscribe Unsubscribe
Results 1 to 4 of 4

ArtS

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 ...

  1. #1
    ArtS is offline Junior Member White Belt
    Join Date
    Apr 2007
    Posts
    6

    Question ArtS

    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?

  2. #2
    Eric Frost's Avatar
    Eric Frost is offline Administrator Black Belt
    Join Date
    Jul 1992
    Posts
    5,094
    Blog Entries
    4

    Re: ArtS

    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

  3. #3
    ArtS is offline Junior Member White Belt
    Join Date
    Apr 2007
    Posts
    6

    Smile Re: ArtS

    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

  4. #4
    Eric Frost's Avatar
    Eric Frost is offline Administrator Black Belt
    Join Date
    Jul 1992
    Posts
    5,094
    Blog Entries
    4

    Re: ArtS

    Just comment out this line or change it to false!

    Code:
     
    oApp.Visible = True

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36