I have an Excel Report Writer and I am trying to link data from the Worksheet into Mappoint for datashapes but I keep getting connection errors. Here is my code. I haven't started the shapes as I can't get the data into the Map.

Any help would be appreciated.


Dim objApp As New MapPoint.Application
Dim objDataSet As MapPoint.DataSet
Dim objDataMap As MapPoint.DataMap
Dim szconn As String
'Set up application and objects to use
objApp.Visible = True
objApp.UserControl = True
szconn = "Activeworkbook.activesheet!A4:A6"
Set objDataSet = objApp.ActiveMap.DataSets.LinkData(szconn, "F1", , geoCountryUnitedStates, , geoImportExcelNamedRange)
objApp.ActiveMap.MapStyle = geoMapStyleData
objDataSet.DisplayDataMap ' necessary to allow editing in the next line

objApp.ActiveMap.DataSets.ShowDataMappingWizard _
'Get the new data map
Set objDataMap = objDataSet.DataMap
'Set the title
objDataMap.LegendTitle = "User-created data map"