Share via


PreferredDeparture property

Returns or sets the preferred departure time from the start point or a stop on a route; similar to clicking Schedule Stop on the Route menu. Returns an error for the end point. Returns midnight if not set. Read/write Date.

Applies to

Objects: Waypoint

Syntax

object.PreferredDeparture

Parameters

Part

Description

object

Required. An expression that returns a Waypoint object.

Example

  Sub SetPreferredDeparture()

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

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

  'Add two waypoints to the map
  objRoute.Waypoints.Add objMap.FindResults("Seattle, WA").Item(1)
  objRoute.Waypoints.Add objMap.FindResults("Spokane, WA").Item(1)

  'Set the time you'd like depart from the start point
  objRoute.Waypoints.Item(1).PreferredDeparture = TimeValue("8:00:00 AM")
  objRoute.Calculate

  End Sub

Note   This sample code is specific for use in MapPoint North America; it is for illustration purposes only.