Hi,
I am trying to add a radius to my mappoint pushpins and have the
following code:
Option Explicit
Dim oMpApp As mappoint.Application
Dim oMap As mappoint.Map
Private Sub Command1_Click()
Dim oDS As mappoint.DataSet
Dim oRS As mappoint.Recordset
Set oDS = oMap.DataSets.Item("My Pushpins")
Set oRS = oDS.QueryAllRecords
Do Until oRS.EOF
Dim oShp As mappoint.Shape
Set oShp = oMap.Shapes.AddShape(geoShapeRadius, _
oRS.Location, 10, 10)
oShp.ZOrder geoSendBehindRoads
oShp.Line.Visible = False
oShp.SizeVisible = False
oShp.Fill.ForeColor = vbBlue
oShp.Fill.Visible = True
oRS.MoveNext
Loop
End Sub
Private Sub Form_Load()
' Try to attach to running instance of MapPoint
On Error Resume Next
Set oMpApp = GetObject(, "MapPoint.Application")
On Error GoTo 0
If oMpApp Is Nothing Then
' Attaching failed - try creating an object
On Error Resume Next
Set oMpApp = CreateObject("MapPoint.Application")
On Error GoTo 0
If oMpApp Is Nothing Then
MsgBox "Could not create MapPoint object"
End
End If
' make the app visible
oMpApp.Visible = True
End If
' Ensure MapPoint survives when app terminates
oMpApp.UserControl = True
' Retrieve the active map
Set oMap = oMpApp.ActiveMap
End Sub
This has worked in the past, but now I am getting a runtime error 91
(object variable or with block not set. . . ) at the following line:
Set oDS = oMap.DataSets.Item("My Pushpins")
Can anyone tell me why I might be getting this error and how to fix
it? Thanks!
I am trying to add a radius to my mappoint pushpins and have the
following code:
Option Explicit
Dim oMpApp As mappoint.Application
Dim oMap As mappoint.Map
Private Sub Command1_Click()
Dim oDS As mappoint.DataSet
Dim oRS As mappoint.Recordset
Set oDS = oMap.DataSets.Item("My Pushpins")
Set oRS = oDS.QueryAllRecords
Do Until oRS.EOF
Dim oShp As mappoint.Shape
Set oShp = oMap.Shapes.AddShape(geoShapeRadius, _
oRS.Location, 10, 10)
oShp.ZOrder geoSendBehindRoads
oShp.Line.Visible = False
oShp.SizeVisible = False
oShp.Fill.ForeColor = vbBlue
oShp.Fill.Visible = True
oRS.MoveNext
Loop
End Sub
Private Sub Form_Load()
' Try to attach to running instance of MapPoint
On Error Resume Next
Set oMpApp = GetObject(, "MapPoint.Application")
On Error GoTo 0
If oMpApp Is Nothing Then
' Attaching failed - try creating an object
On Error Resume Next
Set oMpApp = CreateObject("MapPoint.Application")
On Error GoTo 0
If oMpApp Is Nothing Then
MsgBox "Could not create MapPoint object"
End
End If
' make the app visible
oMpApp.Visible = True
End If
' Ensure MapPoint survives when app terminates
oMpApp.UserControl = True
' Retrieve the active map
Set oMap = oMpApp.ActiveMap
End Sub
This has worked in the past, but now I am getting a runtime error 91
(object variable or with block not set. . . ) at the following line:
Set oDS = oMap.DataSets.Item("My Pushpins")
Can anyone tell me why I might be getting this error and how to fix
it? Thanks!