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

Get Distance Function causes errors

This is a discussion on Get Distance Function causes errors within the Development forums, part of the MapPoint Desktop Discussion category; Hey folks, So the online knowledge base articles I've come across don't quite fit my scenario... Perhaps someone else has ...

  1. #1
    andriy is offline Junior Member Yellow Belt
    Join Date
    Mar 2007
    Posts
    16

    Get Distance Function causes errors

    Hey folks,

    So the online knowledge base articles I've come across don't quite fit my scenario... Perhaps someone else has the same dilemma, or knwos how to remedy it.

    I've written a function in Excel's VBA.
    The purpose is to return the distance between two lat/long points. (If that point isn't near a road, the code refers to a straightline distance calculation that I've adapted named: "Posdist"...

    When I fill my excel worksheet with multiple copies of this function, and have inputs pointing to appropriate cells, with latitude and longitude, after a certain time I get error messages... The kicker is it works when I calculate one cell at a time, but when I recalculate the whole sheet I get errors...

    They read:
    This application is unable to continue running due to an internal error (6-40028--1073741819)
    Error signature
    AppName: mappoint.exe
    Appvers:13.0.15.2800
    Modname:ntdll.dll
    mod version:5.1.2600.2180
    Offset: 00010f29

    I tried uninstalling the network HP printer we have in the office, and unplugging the network cable, and then got a slightly different error:
    with details:
    Modname:mfc71.dll

    Here's my snippet of code, for your perusal:
    hopefully someone has a clue as to my next appropriate step of actio!

    Thnx in advance,
    andriy

    Code:
    --- the PCFLAG input, is binary, and identifies isolated postal codes, so teh algorithm directly calculates distance based on straightline distance)

    Public Function RoadDistance(PCFlag, Lat1, Long1, Lat2, Long2)

    Dim SysApp As New MapPoint.Application
    Dim SysMap As MapPoint.Map
    Dim SysRoute As MapPoint.Route
    Dim SysLoc1 As MapPoint.Location
    Dim SysLoc2 As MapPoint.Location

    If PCFlag = 1 Then
    GoTo Straight
    End If

    Application.ActivateMicrosoftApp xlMicrosoftMappointNorthAmerica

    Application.DisplayAlerts = False

    Set SysMap = SysApp.ActiveMap
    Set SysRoute = SysMap.ActiveRoute

    SysApp.Units = 1

    Set SysLoc1 = SysMap.GetLocation(Lat1, Long1)
    Set SysLoc2 = SysMap.GetLocation(Lat2, Long2)

    SysRoute.Waypoints.Add SysLoc1
    SysRoute.Waypoints.Add SysLoc2

    On Error GoTo IsolatedPC
    SysRoute.Calculate

    RoadDistance = SysRoute.DrivingTime
    SysRoute.Clear
    SysMap.Saved = True
    GoTo Ending

    IsolatedPC:
    SysRoute.Clear
    SysMap.Saved = True
    Straight:
    RoadDistance = Posdist(Lat1, Long1, Lat2, Long2)
    Ending:

    End Function


    any ideas?
    anyone?

  2. #2
    andriy is offline Junior Member Yellow Belt
    Join Date
    Mar 2007
    Posts
    16

    Re: Get Distance Function causes errors

    Doesn't anybody else use mappoint to calculate distances between ZipCodes for an entire dataset of locations?

    Do you folks usually do this in C++? Is my problem that I'm doing it in VBA?

    thanks for your input...

    andriy

  3. #3
    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: Get Distance Function causes errors

    <cheeky answer>

    I sell my own products that do this.

    The one that works from database (or Excel) route listings uses C#.

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

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Help errors
    By spirido in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 05-07-2004, 08:30 AM
  2. Garmin StreetPilot III data errors
    By jalesse in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 12-31-2003, 11:22 PM
  3. Does the distance function btw 2 locations get correct #
    By spideybud in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 12-16-2003, 05:15 PM
  4. Map location errors in Ireland.
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 07-30-2003, 08:34 PM
  5. Random not ready errors
    By ToddRCS in forum MapPoint Desktop Discussion
    Replies: 3
    Last Post: 11-14-2002, 06:31 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 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