1

This code has a run-time error saying object required on this line...

Set objDataSets = objApp.ActiveMap.DataSets

This is what I used as a reference...

http://msdn.microsoft.com/en-us/library/aa723407.aspx


Sub CreateMaps()

Dim MPApp As MapPoint.Application
Set MPApp = New MapPoint.Application

MPApp.Visible = True
MPApp.UserControl = True

OpenDataSet

End Sub

Sub OpenDataSet()

Dim objDataSets As MapPoint.DataSets
Dim objDataSet As MapPoint.DataSet
Dim zDataSource As String

zDataSource = "S:\Projects\StateMapData.xlsx!Data!AY5:AZ56"
Set objDataSets = objApp.ActiveMap.DataSets
Set objDataSet = objDataSets.ImportData(zDataSource)

End Sub
SCar88
  • 110
  • 1
  • 4
  • 13
  • 3
    You need to set `objApp`. Per the page you linked to: "Note This and other samples in this topic assume that MapPoint is already running, and that objApp is a MapPoint Application object that has already been initialized." – Joe Feb 12 '14 at 17:18
  • So my MPApp is the objApp in the OpenDataSet procedure. – SCar88 Feb 12 '14 at 17:29
  • Right, so I'd replace objApp with MPApp in the `Set objDataSets` line. – Joe Feb 12 '14 at 17:33
  • Ok so now I'm getting a Run-time error '4007' Cannot connect with the specified DataSourceMoniker. Any idea what that's about? – SCar88 Feb 13 '14 at 15:23
  • Got that error figured out. Now on to customizing the maps. – SCar88 Feb 13 '14 at 17:44

0 Answers0