MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




Trip duration

This is a discussion on Trip duration within the Development forums, part of the MapPoint 2006/2009 Discussion category; I have an Excel user defined function to return the round trip distance between three way points (the start and ...


Go Back   MapPoint Forums > Map Forums > MapPoint 2006/2009 Discussion > Development

Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read



Click here to register

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-18-2008
Junior Member
White Belt
 
Join Date: Jan 2008
Posts: 8
Question Trip duration

I have an Excel user defined function to return the round trip distance between three way points (the start and end waypoints are the same address). I know Mappoint will report a trip duration in hours and minutes once the "get directions" icon is involked. Is there a way to return the trip duration programmatically using VBA in Excel. I have searched through the Mappoint Object Model but don't find any memebers that would return trip duration.

Thanks for any help!

Trebormac
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2 (permalink)  
Old 01-18-2008
Eric Frost's Avatar
Senior Member
Black Belt
 
Join Date: Jul 1992
Posts: 2,382
Blog Entries: 1
Re: Trip duration

Look some more. I know there is.... I have used it

Take a look at the TripTime Property of the Route Object.

Eric
__________________
~ Now taking orders for MapPoint 2009 ~
~
~ Upgrade to MapForums Plus membership ~
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3 (permalink)  
Old 01-19-2008
Junior Member
White Belt
 
Join Date: Jan 2008
Posts: 8
Re: Trip duration

Thanks Eric,

I did dig a little deeper and found "Driving Time" and "Trip Time", both members of the Route Class....I used the driving time method. With assistance from the MapPoint Help File I was able to create the VBA code I needed.

Fot those interested I have attached the code as a text file. This is in the form of a user defined function in Excel, where I need to compute the driving time from a fixed location (address) to several dozen separate locations. Hence I hard coded the starting point in the code. This of course can be modified if there is no fixed starting point by using multiple input parameters in the function call, e.g., sAddress2, sAddress3, etc. and adding lines of code for each objRoute.Waypoint.FindResults(sAddress2...)

The separate location addresses are in cells in a column. Invoke the function in a cell adjacent to the column containing the separate addresses, point it to the first address and hit OK. Then copy it down the column. If there a lot of addresses it may take some time to calculate.

Thanks again,

Trebormac
Attached Files
File Type: txt VBA Code Drive Time.txt (627 Bytes, 8 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4 (permalink)  
Old 01-19-2008
Eric Frost's Avatar
Senior Member
Black Belt
 
Join Date: Jul 1992
Posts: 2,382
Blog Entries: 1
Re: Trip duration

Very cool, thanks for sharing the code. I am also posting the code in here in case anyone has trouble getting to the attachment.

Code:
Option Explicit

Dim oApp As MapPoint.Application

Function GetDuration(sAddress1 As String)
  Dim objMap As Map
  Dim objRoute As Route

  If oApp Is Nothing Then
      Set oApp = CreateObject("MapPoint.Application")
  End If

  oApp.Visible = False
  Set objMap = oApp.NewMap
  Set objRoute = objMap.ActiveRoute

  'Add route stop and calculate the route
  objRoute.Waypoints.Add objMap.FindResults("69 West Washington Street, Chicago, IL 60606").Item(1)
  objRoute.Waypoints.Add objMap.FindResults(sAddress1).Item(1)
  objRoute.Calculate

  GetDuration = objRoute.DrivingTime / geoOneMinute

  objMap.Saved = True

End Function
__________________
~ Now taking orders for MapPoint 2009 ~
~
~ Upgrade to MapForums Plus membership ~
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
duration, trip


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
Merge routes/trips into one long trip TenOC MapPoint 2006/2009 Discussion 1 05-21-2006 11:48 AM
automate stop duration and multiple routes samlinc MapPoint 2006/2009 Discussion 1 01-22-2006 10:44 AM
Using Mappoint 2002 European edition for planning a USA-trip Anonymous MapPoint 2006/2009 Discussion 1 09-21-2003 06:42 AM
Trip Planning zylogue MapPoint 2006/2009 Discussion 0 03-07-2003 07:30 PM
Trip Standards: I'm thinking about purchasing MapP.... Anonymous MapPoint 2006/2009 Discussion 1 12-17-2001 12:35 PM


All times are GMT -5. The time now is 09:38 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
MP2K Magazine
Visitor Map

Flights to Germany
For flights to Germany book online with Holiday Hypermarket. Why not book some great value accommodation too? Check out how easy it is.

Italy Holidays
Find and book Italy Holidays with Travel Counsellors. Holiday destinations around the world including Italy.

Thailand Holiday
A Thailand Holiday has much to offer with historic culture, lively arts, beautiful beaches, a good nightlife, friendly and hospitable people and one of the best cuisines in the world.

Egypt Holidays
Visit one of the most spectacular sightseeing destinations in the world with The Holiday Place. Egypt holidays provide a fantastic break!

Holiday
Searching for the perfect holiday? Well check out ULookUBook online to find out all about your destination and also to book a great value holiday.

Family activity holidays
Family holidays can be full of fun activity. Check out your options at Travel.co.uk

Cheap Holidays to Goa
Dine on delightful seafood in west India. Find information on cheap holidays in Goa at On The Beach.


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