I have this code in an excel file; the idea being to read two postcodes from cells A1 and B1, and return the distance between them to Cell C1.
I think the code is ok, but when I run it it says "User-Defined type not defined" and highlights the second line.
Do I need to set up a specific tools>reference in Excel VBA first?
Pretty please?!
______________
Sub ShowDistance()
Dim objApp As New MapPoint.Application
Dim objMap As MapPoint.Map
Dim objLocOne As MapPoint.Location
Dim objLocTwo As MapPoint.Location
Dim LocOne, LocTwo As String
Dim Distance As Long
Set objMap = objApp.ActiveMap
LocOne = Cells(1, 1)
LocTwo = Cells(1, 2)
Set objLocOne = objMap.FindResults(LocOne).Item(1)
Set objLocTwo = objMap.FindResults(LocTwo).Item(1)
'Show the distance
Distance = objMap.Distance(objLocOne, objLocTwo)
Cells(1, 3) = Distance
End Sub