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 2 of 2

Code struggling to locate some of my postcodes

This is a discussion on Code struggling to locate some of my postcodes within the MapPoint Desktop Discussion forums, part of the Map Forums category; Hi all, Firstly, thank you all for the useful info contained within this site - I've managed to create some ...

  1. #1
    jovansey is offline Junior Member White Belt
    Join Date
    Dec 2010
    Posts
    1

    Code struggling to locate some of my postcodes

    Hi all,

    Firstly, thank you all for the useful info contained within this site - I've managed to create some basic VB code to do a few basic MapPoint tasks from within Excel, using the information from all of your posts.

    I am, however, struggling with one particular problem... the code I have created to plot UK postcodes as pushpins does not work on a small number of my data items.

    For example, it locates the postcode "RM18 7AH" miles away from where it should actually be.

    Any help gratefully recieved - thanks in anticipation.

    Paul.

    Here is my code:

    Code:
     
    Private Sub CommandButton3_Click()
      Set oApp = CreateObject("MapPoint.Application")
      oApp.Visible = True
      Set objMap = oApp.NewMap
      
      nReadRow = 2
      nShapeIndex = 1
      
      Do While Worksheets("MapPoint").Cells(nReadRow, 1) <> ""
           
        Set objLoc = _
        objMap.FindAddressResults( _
        Worksheets("MapPoint").Cells(nReadRow, 1), _
        Worksheets("MapPoint").Cells(nReadRow, 1), , _
        Worksheets("MapPoint").Cells(nReadRow, 1), _
        Worksheets("MapPoint").Cells(nReadRow, 1))(1)
      
        objMap.AddPushpin objLoc, _
          Worksheets("MapPoint").Cells(nReadRow, 1)
        
        nShapeIndex = nShapeIndex + 1
        nReadRow = nReadRow + 1
      Loop
        
    End Sub

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

    Re: Code struggling to locate some of my postcodes

    I'd imagine column 1 has the postcode.

    You're putting it in multiple times as a parameter to elements that are not expecting postcodes. You should only put it in for the one parameter that is for the post code, not for the address & city, etc. e.g. it should only be there once. The others you could leave blank.

    Alternatively, you could try FindPlaceResults.

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

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. how to use GIS to locate points on map using c#???
    By eng\kareem in forum Other Mapping Platforms
    Replies: 2
    Last Post: 03-05-2010, 03:16 PM
  2. Import postcodes and name each one with a code
    By richard in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 12-03-2008, 02:25 PM
  3. Replies: 0
    Last Post: 04-01-2005, 09:31 AM
  4. Locate Line
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 08-11-2004, 08:53 AM

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 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127