Share via


AddPushpin method

Adds a Pushpin to the map in the My Pushpins set. Returns the newly created Pushpin object.

Applies to

Objects:  Map

Syntax

object.AddPushpin(AtLocation, [Name])

Parameters

Part Description
object Required. An expression that returns a Map object.
AtLocation Required Location object. Location on the map where the Pushpin should be placed.
Name Optional String. A name for the Pushpin that is created. If a name is not specified, the name of the location is used. If a name is not specified and the location does not have a name, "Untitled" is used.

Example

    Sub AddPushpinToTheMap()

  Dim objApp As New MapPoint.Application   Dim objLoc As MapPoint.Location
  'Set up application and get a location   objApp.Visible = True   objApp.UserControl = True   Set objLoc = objApp.ActiveMap.FindResults("Seattle, WA")(1)
  'Add a Pushpin to the map at this location   objApp.ActiveMap.AddPushpin objLoc, "Added Pushpin"
  End Sub

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