MapPoint Automation Expert Required

clive2002

Registered User.
Local time
Today, 05:29
Joined
Apr 21, 2002
Messages
90
I'm trying to write some code to return the distance, drive time and so on between two locations ( which will be entered through a form in access.

Just testing the basic objects in Mappoint at the moment and i have a problem finding addresses. I'd like to just us the post code as this works perfectly when i use mappoint manually.

However the code below doesn't seem to be able to return an address unless i specify all the information. and then it sometimes it still doesn't even though it will manually?

Can anybody help?
Is there a betterway?

Function Test()

Dim objApp As New MapPoint.Application
Dim objLoc(1 To 2) As MapPoint.Location

With objApp.ActiveMap

Set objLoc(1) = .FindAddress("Threadwood Road", "Wythenshawe", "Manchester", "M22 ORR", geoCountryUnitedKingdom)
Set objLoc(2) = .FindAddress("", "", "", "M22 ORR", geoCountryUnitedKingdom)

End With

With objApp.ActiveMap.ActiveRoute.Waypoints
.Add objLoc(1), "Manchester1"
.Add objLoc(2), "Manchester2"
End With

objApp.ActiveMap.ActiveRoute.Calculate

MsgBox objApp.ActiveMap.ActiveRoute.DrivingTime

End Function
 

Users who are viewing this thread

Back
Top Bottom