using mappoint in Excel VB

M

Mike Macgowan

I am trying to call this routine to publish a list of pushpins in mappoint.
The application was compiled in VB and works fine, but I want to tie it to
my data in a seamless application and to change a couple of variables like
the radius size and the background color. Can anyone tell me how to call
this app in VB for Excel?

Sub mappoint()
Option Explicit
Dim MpApp As mappoint.Application
Dim Map As mappoint.Map

Private Sub Command1_Click()
Dim DS As mappoint.DataSet
Dim RS As mappoint.Recordset

Set DS = Map.DataSets.Item("My Pushpins")
Set RS = DS.QueryAllRecords
Do Until oRS.EOF
Dim oShp As mappoint.Shape
Set oShp = Map.Shapes.AddShape(geoShapeRadius, _
RS.Location, 7, 7)
Shp.ZOrder geoSendBehindRoads
Shp.Line.Visible = False
Shp.SizeVisible = False
Shp.Fill.ForeColor = vbBlue
ohp.Fill.Visible = True
RS.MoveNext
Loop
End Sub

Private Sub Form_Load()
' Try to attach to running instance of MapPoint
On Error Resume Next
Set MpApp = GetObject(, "MapPoint.Application")
On Error GoTo 0


If MpApp Is Nothing Then
' Attaching failed - try creating an object
On Error Resume Next
Set MpApp = CreateObject("MapPoint.Application")
On Error GoTo 0

If MpApp Is Nothing Then
MsgBox "Could not create MapPoint object"
End
End If
' make the app visible
MpApp.Visible = True
End If

' Ensure MapPoint survives when app terminates
MpApp.UserControl = True

' Retrieve the active map
Set Map = MpApp.ActiveMap
End Sub

End Sub


Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top