View Single Post

  #1 (permalink)  
Old 02-20-2004
Anonymous Anonymous is offline
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
i want to use this example but it don't work

Hello,
I use Mappointcontrol and visual basic 6.
I want to use this code but when i execute my program it tell : "Erreur d'execution : -2147024809" on the line "Set mpDataSet = mpDatasets.ImportData......"
Can someone help me ??
Sorry for my bad english but i'm french

My excel file structure is :

A1:Latitude A2:48°52
B1:Longitude B2:2°20
C1:City C2:Paris

My code is :

Dim mpApp As MapPoint.Application
Dim mpDatasets As MapPoint.DataSets
Dim mpDataSet As MapPoint.DataSet
Dim myExampleArray(3, 2)

'Start MapPoint
Set mpApp = New MapPoint.Application
mpApp.Visible = True
mpApp.UserControl = True

'Get the DataSets collection
Set mpDatasets = mpApp.NewMap.DataSets

'Create the ArrayOfFields descriptions

'Field is specified by name
myExampleArray(1, 1) = "Latitude"
'tells MapPoint to use this field as the latitude field
myExampleArray(1, 2) = geoFieldLatitude

'Field again specifed by name
myExampleArray(2, 1) = "Longitude"
'tells MapPoint to use this field as the longitude field
myExampleArray(2, 2) = geoFieldLongitude

'Field is listed by index, rather than name
myExampleArray(3, 1) = 1
'tells MapPoint to use this field as additional (non geocoding) information
myExampleArray(3, 2) = geoFieldData



'Perform the import
Set mpDataSet = mpDatasets.ImportData("c:\foo.xls!Feuil1!A1:B3", myExampleArray)

'The (x,2) elements are of the type GeoFieldType or string.
'If string, then they set the new name of the field, and
'MapPoint assumes that the field is a nongeocoding data field.
Reply With Quote