MapPoint and VBA - Any Active Users?

lummers

New Member
Joined
Dec 10, 2017
Messages
9
Hello all

1st post on the forums but have been a long-time browser :)


I am wondering if anybody can help point me to some good MapPoint resources or can help me with some code. I think what I am trying to do is quite simple but struggling to get started.


In Excel, I will have a list of Routes with postcodes:


[TABLE="width: 500"]
<tbody>[TR]
[TD]Business[/TD]
[TD]Pin Title[/TD]
[TD]ID Number[/TD]
[TD]Postcode[/TD]
[TD]Route[/TD]
[/TR]
[TR]
[TD]Cake and Cookies[/TD]
[TD]Cake and Cookie (1234)[/TD]
[TD]1234[/TD]
[TD]AB1 2DE[/TD]
[TD]Route 01[/TD]
[/TR]
[TR]
[TD]Hot Choc Inc[/TD]
[TD]Hot Choc Inc (5678)[/TD]
[TD]5678[/TD]
[TD]FG3 4HI[/TD]
[TD]Route 02[/TD]
[/TR]
</tbody>[/TABLE]


I want each of the routes to be made into their own pushpin set. So Route 1 will have pins for every postcode, Route 2 will be its own set, etc.


Then, I will apply some formula in Excel to ultimately give a 'Red'/'Amber'/'Green' status to each postcode (e.g. via text string). I then want each individual pushpin to change icon/colour based on that status.

Can anybody give me a solid starter for 10? I have tried to read the MapPoint developer documentation but it is beyond my current capabilities: https://msdn.microsoft.com/en-us/library/aa562254.aspx

I also fear that some code I am trying to use is incompatible with my versions (regional differences, version differences, etc.)

Excel 2016 32-Bit
MapPoint EU 2013

Big thanks to any one still using the deprecated software!!
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
OK, I have made a little bit of progress.

First thing to do is open new Excel and new MapPoint. Then, open VBA and go to Tools -> References. Then, select 'Microsoft MapPoint Control 19.0'.

Putting in the following code allows me to create a pushpin set called "I am Spartacus" and places a pushpin on the postcode. It's a start...

Code:
    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( _
        "SW1A 2AA")(1))


    Set oDS = oMap.DataSets
    Set oPPSet = oMap.DataSets.AddPushpinSet("I am spartcaus")
    oPin.MoveTo oPPSet
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,240
Members
452,621
Latest member
Laura_PinksBTHFT

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top