Welcome to MapForums!

Register, sign in, or use Facebook Connect above to join in and participate in the forum.

When you are signed in, this message, the ads in this row, and the red-underlined link ads all go away.

Subscribe to receive our newsletter.
Subscribe Unsubscribe
Page 1 of 2 12 LastLast
Results 1 to 10 of 14

using ImportData with VBScript

This is a discussion on using ImportData with VBScript within the Development forums, part of the MapPoint Desktop Discussion category; I have problems using ImportData. Somehow the call of ImportData fails Please help! Dim oMP, oDSSMP, oDSMP Set oMP = ...

  1. #1
    Pit Mueller is offline Junior Member White Belt
    Join Date
    Dec 2007
    Location
    Germany
    Posts
    9

    Unhappy using ImportData with VBScript

    I have problems using ImportData. Somehow the call of ImportData fails
    Please help!

    Dim oMP, oDSSMP, oDSMP
    Set oMP = GetObject(, "MapPoint.Application")
    Set oDSSMP = oMP.ActiveMap.DataSets

    ' geoFieldName = 1
    ' geoFieldName2 = 2
    ' geoFieldAddress1 = 3
    ' geoFieldCity = 6
    ' geoFieldPostal1 = 11
    ' geoFieldCountry = 15
    ' geoFieldInformation 22
    ' geoFieldData 23
    Dim myExampleArray(3, 2)
    myExampleArray(1, 1) = "Name"
    myExampleArray(1, 2) = 1 'geoFieldName

    myExampleArray(2, 1) = "Vorname"
    myExampleArray(2, 2) = 2 'geoFieldName2

    myExampleArray(3, 1) = "Land"
    myExampleArray(3, 2) = 15 'geoFieldCountry


    Set oDSMP = oDSSMP.ImportData("C:\Temp\export.txt", myExampleArray, , 9)

  2. #2
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433

    Re: using ImportData with VBScript

    Hi,

    What exacly fails, what is the error, is there an exception raised ?

  3. #3
    Pit Mueller is offline Junior Member White Belt
    Join Date
    Dec 2007
    Location
    Germany
    Posts
    9

    Re: using ImportData with VBScript

    The Code is:

    800A0FC6

    "Data could not be imported, columns not found" (translated from german message)

    Set oDSMP = oDSSMP.ImportData(sMyFile, myExampleArray, 39070, 9, 1)

    Last Parameter means geoImportFirstRowNotHeadings

  4. #4
    Winwaed's Avatar
    Winwaed is offline Mapping-Tools.com Black Belt
    Join Date
    Feb 2004
    Location
    Irving,Texas
    Posts
    1,859
    Blog Entries
    60

    Re: using ImportData with VBScript

    But the first row consists of column headings, doesn't it?

    (and if it doesn't, how are you telling it what each column is?)

    Richard
    Winwaed Software Technology LLC
    http://www.winwaed.com
    See http://www.mapping-tools.com for MapPoint Tools

  5. #5
    Pit Mueller is offline Junior Member White Belt
    Join Date
    Dec 2007
    Location
    Germany
    Posts
    9

    Re: using ImportData with VBScript

    Quote Originally Posted by Winwaed View Post
    But the first row consists of column headings, doesn't it?

    (and if it doesn't, how are you telling it what each column is?)

    Richard
    No -> i use the array to tell him what columns exist in that file.

    Regards

    Pit

  6. #6
    Eric Frost's Avatar
    Eric Frost is offline Administrator Black Belt
    Join Date
    Jul 1992
    Posts
    5,094
    Blog Entries
    4

    Re: using ImportData with VBScript

    Can you post a sample of the export.txt text file as an attachment?

    Eric
    ~ Order MapPoint MapPoint 2013 Here and Get Free Access to the MapForums Downloads ~
    ~~
    ~ Upgrade to Get Access to the MapForums Downloads ~

  7. #7
    Pit Mueller is offline Junior Member White Belt
    Join Date
    Dec 2007
    Location
    Germany
    Posts
    9

    Re: using ImportData with VBScript

    Dim myExampleArray(6, 1)

    myExampleArray(1, 1) = 1 'geoFieldName

    myExampleArray(2, 1) = 2 'geoFieldName2

    myExampleArray(3, 1) = 15 'geoFieldCountry

    myExampleArray(4, 1) = 6 'geoFieldCity

    myExampleArray(5, 1) = 3 'geoFieldAddress1

    myExampleArray(6, 1) = 11 'geoFieldPostal1

    Set oDSMP = oDSSMP.ImportData(sMyFile, myExampleArray, 39070, 9, 1)
    Attached Files Attached Files

  8. #8
    Eric Frost's Avatar
    Eric Frost is offline Administrator Black Belt
    Join Date
    Jul 1992
    Posts
    5,094
    Blog Entries
    4

    Re: using ImportData with VBScript

    Are you able to import it using the regular MapPoint interface / wizard?

    I've never imported fixed width text, only CSV or comma-separated.

    Can you convert to CSV and see if that helps it to work?

    By the way, this is my 2,000th post!

    Eric
    Last edited by Eric Frost; 01-28-2008 at 09:35 AM.
    ~ Order MapPoint MapPoint 2013 Here and Get Free Access to the MapForums Downloads ~
    ~~
    ~ Upgrade to Get Access to the MapForums Downloads ~

  9. #9
    Pit Mueller is offline Junior Member White Belt
    Join Date
    Dec 2007
    Location
    Germany
    Posts
    9

    Re: using ImportData with VBScript

    Hi Eric!

    Thank you for your help!!

    Yes i can import the file directy using the wizard.
    The columns are not fixed, they are separated by TABs

    Pit

  10. #10
    Eric Frost's Avatar
    Eric Frost is offline Administrator Black Belt
    Join Date
    Jul 1992
    Posts
    5,094
    Blog Entries
    4

    Re: using ImportData with VBScript

    Just want to be sure - it is working for you now?

    What did you do? Switch to CSV?

    Eric
    ~ Order MapPoint MapPoint 2013 Here and Get Free Access to the MapForums Downloads ~
    ~~
    ~ Upgrade to Get Access to the MapForums Downloads ~

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. ImportData
    By lacja in forum MapPoint Desktop Discussion
    Replies: 6
    Last Post: 11-19-2006, 10:57 AM
  2. MapPoint 2002 with ASP (vbscript)
    By eatech in forum MapPoint Desktop Discussion
    Replies: 6
    Last Post: 05-05-2005, 05:12 AM
  3. ImportData
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 11-04-2004, 04:05 AM
  4. Will Pay $$$ for Assistance - ASP / VBSCRIPT
    By webdbx in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 07-09-2004, 09:31 PM
  5. Clientside VBScript and MapPoint?
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 4
    Last Post: 03-14-2004, 06:34 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85