View Full Version : Adding another pushpin set to a map

11-15-2010, 01:38 PM
I found the following code on the web and was able to modify it slightly to work and it works well. I was wondering how to modify it so I could add another pushpin set to an open mappoint map? thanks much an extreme novice.

Dim objMap As MapPoint.Map
Dim objLoc As MapPoint.Location
Dim objPushpin As MapPoint.Pushpin
Private Sub submitMapChoice_Click()
Set oApp = CreateObject("MapPoint.Application.NA")
Set objMap = oApp.NewMap
'start reading on row 2 of spreadsheet
nReadRow = 2

Do While Sheets("MapData").Cells(nReadRow, 1) <> ""
MyLat = Sheets("MapData").Cells(nReadRow, 1)
MyLon = Sheets("MapData").Cells(nReadRow, 2)
szname = Sheets("MapData").Cells(nReadRow, 4)
Set objLoc = objMap.GetLocation(MyLat, MyLon, 0)
Set objPushpin = objMap.AddPushpin(objLoc, szname)
objPushpin.Note = Sheets("MapData").Cells(nReadRow, 4)
objPushpin.BalloonState = geoDisplayName
nReadRow = nReadRow + 1
oApp.Visible = True
oApp.WindowState = geoWindowStateMaximize
objMap.DataSets(1).Name = "MarketPointe - LandTracker"
End Sub