Reputation: 11
Am stumped with a BingMaps API Compile error, Basically it runs in Microsoft Office 2010 without issue, however when I try and run this in Office 2016 it fails to run and thought's a vba debug error.
Function GetDistance(sPCode As String, ePcode As String) As Double
Dim t As String
Dim re As XMLHTTP
t = "http://dev.virtualearth.net/REST/V1/Routes/Driving?o=xml&wp.0=" & sPCode & "&wp.1=" & ePcode & "&avoid=minimizeTolls&du=mi&key=AjfyHbOP6UDABNbXmV59momsvs6cRqjrIz4g0bbsmGyBAJz1TgTgqRXS_PfWcm5k"
Set re = New XMLHTTP
re.Open "get", t, False
re.send
Do
DoEvents
Loop Until re.readyState = 4
With re
s = Split(.responseText, "<TravelDistance>")
End With
GetDistance = Val(s(1))
End Function
Upvotes: 1
Views: 490
Reputation: 11
I was having the same problem!
Not sure if this will work for you, but on tools, references deselect Microsoft XML V6 and select V3.0.
that's worked for me.
Regards
Upvotes: 1