Welcome to MapForums!

Register, sign in, or use Facebook Connect above to join in and participate in the forum.

When you are signed in, this message, the ads in this row, and the red-underlined link ads all go away.

Subscribe to receive our newsletter.
Subscribe Unsubscribe
Results 1 to 5 of 5

Adding Multiple Pushpin Sets to Map

This is a discussion on Adding Multiple Pushpin Sets to Map within the MapPoint Desktop Discussion forums, part of the Map Forums category; I'm new at working with excel vba code for mappoint so thans in advance and sorry for not. The code ...

  1. #1
    rvalone is offline Junior Member White Belt
    Join Date
    Nov 2010
    Posts
    10

    Question Adding Multiple Pushpin Sets to Map

    I'm new at working with excel vba code for mappoint so thans in advance and sorry for not. The code below takes data from an excel speadsheet and send that data to mappoint. Can't figure out how to send multiple datasets to the same ActiveMap as this code creates a new mappoint file everytime it runs.

    Private Sub submitMapChoice_Click()
    Set mapdataSheet = Sheets("MapData")

    If Me.MapPointOption.Value Then

    'Run macro that creates dataset to export to Mappoint
    Me.MapDataOut
    ActiveWorkbook.Unprotect Password:="DanJoannWinkler"
    mapdataSheet.Visible = True
    mapdataSheet.Activate
    mapdataSheet.Range("A1").Select

    'Run macro to transform 20 detailed concept to 8 generic concepts
    If Me.MapPointOption.Value = True Then Me.ChangeConcept
    Unload Me

    Set oApp = CreateObject("MapPoint.Application.NA")
    Set objMap = oApp.NewMap

    'start reading on row 2 of spreadsheet
    nReadRow = 2

    'test to see if there is an address in column 1 (A) for the current row
    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 = "Dev - " & Sheets("MapData").Cells(nReadRow, 5)

    'Determine color of pushpin based upon concept
    Dim stylenum As Integer
    stylenum = 0
    currentstyle = Worksheets("MapData").Cells(nReadRow, 3)
    Select Case (currentstyle)
    Case "Apartments":
    stylenum = 17 ' red
    Case "Medium Density Attached":
    stylenum = 22 ' green
    Case "High Density Attached":
    stylenum = 23 ' purple
    Case "Condo Conversion":
    stylenum = 21 ' blue-green
    Case "Detached":
    stylenum = 20 ' blue
    Case Else:
    stylenum = 18 ' yellow
    End Select
    objPushpin.Symbol = stylenum
    If Me.ShowLabels = True Then
    objPushpin.BalloonState = geoDisplayName
    End If
    nReadRow = nReadRow + 1
    Loop

    oApp.Visible = True
    oApp.WindowState = geoWindowStateMaximize
    objMap.DataSets.ZoomTo
    objMap.DataSets(1).Name = "MarketPointe - ResidentialTrends"
    End If
    End Sub

  2. #2
    Winwaed's Avatar
    Winwaed is offline Mapping-Tools.com Black Belt
    Join Date
    Feb 2004
    Location
    Irving,Texas
    Posts
    1,859
    Blog Entries
    60

    Re: Adding Multiple Pushpin Sets to Map

    Add a new pushpin set (pushpin dataset) using the Datasets's AddPushpinSet method.

    Eg.

    myMap.DataSets.AddPushpinSet("My New Pushpin Set")



    After creating a pushpin, you can move it to a different pushpin set by using the MoveTo() method:

    myPushpin.MoveTo("My New Pushpin Set")

    Both are described in MapPoint's help file.


    Richard
    Winwaed Software Technology LLC
    http://www.winwaed.com
    See http://www.mapping-tools.com for MapPoint Tools

  3. #3
    rvalone is offline Junior Member White Belt
    Join Date
    Nov 2010
    Posts
    10

    Re: Adding Multiple Pushpin Sets to Map

    How to I activiate an opened map so I can send a second dataset to that map as the following code always opens a new map window

    Set oApp = CreateObject("MapPoint.Application.NA")
    Set objMap = oApp.NewMap

  4. #4
    Winwaed's Avatar
    Winwaed is offline Mapping-Tools.com Black Belt
    Join Date
    Feb 2004
    Location
    Irving,Texas
    Posts
    1,859
    Blog Entries
    60

    Re: Adding Multiple Pushpin Sets to Map

    Yes that code creates a new map. I don't understand what you mean: MapPoint can only display one map at a time.


    Richard
    Winwaed Software Technology LLC
    http://www.winwaed.com
    See http://www.mapping-tools.com for MapPoint Tools

  5. #5
    rvalone is offline Junior Member White Belt
    Join Date
    Nov 2010
    Posts
    10

    Re: Adding Multiple Pushpin Sets to Map

    I have a map open with a pushpin set already on that map. Now I want to add an additional set of pushpins to the map. I've found code such as the following but when I try to run it nothing happens.


    Sub NewPushpinSet() Dim oMap As MapPoint.Map Set oMap = GetObject(, "MapPoint.Application").ActiveMap Dim oPPSet As MapPoint.DataSet Dim oPin As MapPoint.Pushpin Dim oDS As MapPoint.DataSets Set oPin = oMap.AddPushpin(oMap.FindResults( _ "Space Needle, Seattle, WA")(1)) Set oDS = oMap.DataSets Set oPPSet = oMap.DataSets.AddPushpinSet("Deliveries") oPin.MoveTo oPPSetEnd Sub

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. New user: Exporting multiple data sets to excel
    By rpone605 in forum Products: Pushpin Tool, Single State Mapper
    Replies: 0
    Last Post: 06-20-2006, 03:54 PM
  2. Mapping multiple sets of sales data
    By LS in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 08-18-2004, 06:32 PM
  3. Unable to export Long & Lat for multiple data sets
    By Anonymous in forum Products: Pushpin Tool, Single State Mapper
    Replies: 0
    Last Post: 06-18-2004, 11:50 AM
  4. Viewing multiple data sets on a map.
    By Pauluk in forum MapPoint Desktop Discussion
    Replies: 4
    Last Post: 11-21-2003, 10:12 PM
  5. MapPoint 2002 Is it possible to add multiple sets ....
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 10-22-2001, 08:52 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


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 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125