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
Results 1 to 3 of 3

Adding Pushpins from Excel 2003

This is a discussion on Adding Pushpins from Excel 2003 within the MapPoint Desktop Discussion forums, part of the Map Forums category; I need a simple way to add pushpins from excel 2003. I have name address city province postalcode defined in ...

  1. #1
    Marktherob is offline Junior Member White Belt
    Join Date
    Nov 2005
    Posts
    3

    Adding Pushpins from Excel 2003

    I need a simple way to add pushpins from excel 2003.

    I have name address city province postalcode defined in each row so I need to loop through each adding a pushpin for each row. I am a newbie with VBA no experience basically but I know computers and am an old cobol programmer. Can someone help.

    Thanks Mark

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

    I do not know VBA, but I post you an example in C#, so this should you get you going I think. If I should post in VBA I would give you too many syntax errors

    Code:
        FindResults Results = mp.ActiveMap.FindAddressResults(street, city, othercity, region, zip, country);
        if &#40;Results.ResultsQuality <= GeoFindResultsQuality.geoAmbiguousResults&#41; &#123;
            object o = 1;
            Location Loc = &#40;Location&#41;Results.get_Item&#40;ref o&#41;;
            Pushpin PP = mp.ActiveMap.AddPushpin&#40;Loc, ""&#41;;
            PP.Symbol = 20;
            PP.GoTo&#40;&#41;;
        &#125;

  3. #3
    I.T. is offline Junior Member White Belt
    Join Date
    Mar 2005
    Posts
    9
    The data from Excel can be imported as a dataset using VBA then saved as a mapoint file. The following is code to loop through eight different worksheets (two different types of data - created earlier in the module) and assigns them different pushpins.

    Code:
    Dim objApp As New MapPoint.Application
    Dim objset1&#40;1 To 4&#41;, objset2&#40;1 To 4&#41; As MapPoint.DataSet
    Dim dsetname1, dsetname2, mptfname, mptfpath, savdate As String
    
    objApp.Visible = True
    objApp.UserControl = True
    savdate = Evaluate&#40;"TEXT&#40;TODAY&#40;&#41;,""yyyymmdd""&#41;"&#41;
    
    For c = 1 To 4
        dsetname1 = xlsfpath & "!" & data&#40;c&#41; & "shname1"
        dsetname2 = xlsfpath & "!" & data&#40;c&#41; & "shname2"
    '   Gives format of "C&#58;\Directory\Workbook.xls!1shname1"
        With objApp.ActiveMap.DataSets
            Set objset1&#40;c&#41; = .ImportData&#40;dsetname1, , geoCountryUnitedKingdom, , geoImportExcelSheet&#41;
            Set objset2&#40;c&#41; = .ImportData&#40;dsetname2, , geoCountryUnitedKingdom, , geoImportExcelSheet&#41;
        End With
        objset1&#40;c&#41;.Symbol = 56 + c
        objset2&#40;c&#41;.Symbol = 16 + c
        objset1&#40;c&#41;.ZoomTo
    Next c
        mptfname = "Mapping" & savdate
        mptfpath = Application.GetSaveAsFilename&#40;mptfname, FileFilter&#58;="MapPoint Files &#40;*.ptm&#41;,*.ptm", FilterIndex&#58;=1, _
            Title&#58;="Select Save location for MapPoint Data"&#41;
        objApp.ActiveMap.SaveAs &#40;mptfpath&#41;
    This has a number of variables that are drawn from earlier in the module where the worksheets were named with the numbers 1 to 4 (in preparation for doing this with for..next) and assigns each of the datasets with different symbols according to their number.

    The worksheets were also set up with the correct headings - lat, long, name etc to simplify the import. This was written in Excel 2003 working with Mappoint.EU11 (2004 Europe edition) but can easily be run with the US version.

    Hope this is of some assistance.

    Cheers

    Iain

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Adding pushpins by lat/long or address using MPC in MSAccess
    By GM in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 11-01-2004, 01:00 PM
  2. Adding Pushpins
    By Matrices in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 11-28-2003, 11:32 AM
  3. Adding pushpins and viewing map from access project
    By Dazzer in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 11-07-2003, 06:09 AM
  4. Is there a fast way of adding pushpins?
    By matt1168 in forum MapPoint Desktop Discussion
    Replies: 3
    Last Post: 07-24-2003, 10:44 AM
  5. in adding vendors in the excel side to be linked t....
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 11-14-2001, 10:18 AM

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