Public
Function
Entfernung _
( _
Start_Strasse
As
String
, Start_Stadt_PLZ
As
String
, _
Start_Bundesland
As
String
, Start_Staat
As
String
, _
Ziel_Strasse
As
String
, Ziel_Stadt_PLZ
As
String
, _
Ziel_Bundesland
As
String
, Ziel_Staat
As
String
_
)
Dim
surl
As
String
Dim
oXH
As
Object
Dim
bodytxt
As
String
Replace(Start_Strasse,
" "
,
"+"
) &
"+"
& Replace(Start_Stadt_PLZ,
" "
,
"+"
) &
"+"
& _
Replace(Start_Bundesland,
" "
,
"+"
) &
"+"
& Replace(Start_Staat,
" "
,
"+"
) & _
"&destinations="
& _
Replace(Ziel_Strasse,
" "
,
"+"
) &
"+"
& Replace(Ziel_Stadt_PLZ,
" "
,
"+"
) &
"+"
& _
Replace(Ziel_Bundesland,
" "
,
"+"
) &
"+"
& Replace(Ziel_Staat,
" "
,
"+"
) & _
"&mode=driving&sensor=false&units=metric"
Set
oXH = CreateObject(
"msxml2.xmlhttp"
)
With
oXH
.Open
"get"
, surl,
False
.send
bodytxt = .responseText
End
With
bodytxt = Right(bodytxt, Len(bodytxt) - InStr(1, bodytxt,
"<value>"
) - 5)
bodytxt = Right(bodytxt, Len(bodytxt) - InStr(1, bodytxt,
"<value>"
) - 6)
Entfernung = Left(bodytxt, InStr(1, bodytxt,
"</value>"
) - 1) / 1000
Set
oXH =
Nothing
End
Function