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 6 of 6

Total State Miles

This is a discussion on Total State Miles within the Development forums, part of the MapPoint Desktop Discussion category; Trying to find a way to get Total State Miles. Run a route from point A to point B. Say ...

  1. #1
    Fog Line is offline Junior Member White Belt
    Join Date
    Aug 2008
    Location
    Ringgold, GA.
    Posts
    4

    Total State Miles

    Trying to find a way to get Total State Miles. Run a route from point A to point B. Say Atlanta, GA. to Ontario, CA. I need Total State Miles.

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

    Re: Total State Miles

    Fog Line,

    Welcome to the forum!

    This can be done with a custom macro.. I prepared something for a CPA client earlier this year that actually calculated mileage by county, calculating mileage by State is actually a lot easier.

    Are you versed in any Excel macro programming? Would you be interested in some training on how to prepare this or would you like me to do for you? It's fairly simple either way, probably just 1-2 hours.

    Eric
    ~ Order MapPoint MapPoint 2013 Here and Get Free Access to the MapForums Downloads ~
    ~~
    ~ Upgrade to Get Access to the MapForums Downloads ~

  3. #3
    Fog Line is offline Junior Member White Belt
    Join Date
    Aug 2008
    Location
    Ringgold, GA.
    Posts
    4

    Re: Total State Miles

    Hello Eric Thanks for your reply. Yes I can do Excel macro programming. Do you have a sample of it I Excel? If I see it I should be able to make it work in MS Access. You can send it to my email also if you like.

  4. #4
    Fog Line is offline Junior Member White Belt
    Join Date
    Aug 2008
    Location
    Ringgold, GA.
    Posts
    4

    Re: Total State Miles

    Quote Originally Posted by Eric Frost View Post
    Fog Line,

    Welcome to the forum!

    This can be done with a custom macro.. I prepared something for a CPA client earlier this year that actually calculated mileage by county, calculating mileage by State is actually a lot easier.

    Are you versed in any Excel macro programming? Would you be interested in some training on how to prepare this or would you like me to do for you? It's fairly simple either way, probably just 1-2 hours.

    Eric
    Hello Eric Thanks for your reply. Yes I can do Excel macro programming. Do you have a sample of it I Excel? If I see it I should be able to make it work in MS Access. You can send it to my email also if you like.

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

    Re: Total State Miles

    Check the Direction object documentation in the help file. There is an ElapsedDistance Property you can use to keep track of the mileage. I didn't test the code below but it should work.

    Scan the Instructions to see if there is a specific string that tells you when you are entering a new state.

    Code:
    Sub EnumerateDirections()
    
      Dim objApp As New MapPoint.Application
      Dim objMap As MapPoint.Map
      Dim objRoute As MapPoint.Route
      Dim DIR As MapPoint.Direction
    
      'Set up the 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
    
      For Each DIR in objRoute.Directions 
        Debug.Print DIR.ElapsedDistance & "-" & DIR.Instruction 
      Next
    End Sub
    ~ Order MapPoint MapPoint 2013 Here and Get Free Access to the MapForums Downloads ~
    ~~
    ~ Upgrade to Get Access to the MapForums Downloads ~

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

    Re: Total State Miles

    By the way, that code would work in Excel or Access equally well, you would just want to interact with data in either one.

    There are some recent articles for working with MapPoint in Access VBA!

    MP2K Magazine Articles

    Access VBA Programming Part I - Geocoding with MapPoint

    Access VBA Programming Part II - Calculating a Distance Matrix

    Hope this helps!

    Eric
    ~ Order MapPoint MapPoint 2013 Here and Get Free Access to the MapForums Downloads ~
    ~~
    ~ Upgrade to Get Access to the MapForums Downloads ~

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. miles traveled in each state in a route
    By awalter2r in forum MapPoint Desktop Discussion
    Replies: 4
    Last Post: 11-14-2010, 08:41 PM
  2. total newbie
    By tuktuk in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 10-02-2008, 09:36 AM
  3. Sum Total by State
    By davidkralik in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 06-10-2008, 02:28 AM
  4. State Miles For A Route
    By Anonymous in forum Wish List
    Replies: 0
    Last Post: 07-12-2004, 05:31 PM
  5. State Miles For A Route
    By Anonymous in forum Wish List
    Replies: 0
    Last Post: 02-18-2004, 10:08 AM

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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127