Share via


CopyDirections method

Copies driving directions to the Clipboard; similar to clicking Copy Directions on the Edit menu. If no directions exist, then nothing is copied.

Applies to

Objects:  Map

Syntax

object.CopyDirections

Parameters

Part Description
object Required. An expression that returns a Map object.

Remarks

Driving directions are created when a route is calculated by using the Calculate method on a Route object, or by clicking Get Directions on the Route menu in the user interface.

Example

    Sub CopyDirectionToClipboard()

  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 and calculate   objRoute.Waypoints.Add objMap.FindResults("Seattle, WA").Item(1)   objRoute.Waypoints.Add objMap.FindResults("Redmond, WA").Item(1)   objRoute.Calculate
  'Copy the directions to the Clipboard for use elsewhere   objMap.CopyDirections   MsgBox "Directions copied to the Clipboard."
  End Sub

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