Public
Function
distanz _
( _
start
As
String
, _
ziel
As
String
_
)
Dim
surl
As
String
Dim
oXH
As
Object
Dim
bodytxt
As
String
Dim
distanc_e
As
String
start = Replace(start,
" "
,
"+"
)
start = Replace(start,
"ß"
,
"ss"
)
start = Replace(start,
"ä"
,
"ae"
)
start = Replace(start,
"ü"
,
"ue"
)
start = Replace(start,
"ö"
,
"oe"
)
start = Replace(start,
"Ö"
,
"Oe"
)
start = Replace(start,
"Ä"
,
"Ae"
)
start = Replace(start,
"Ü"
,
"Ue"
)
ziel = Replace(ziel,
" "
,
"+"
)
ziel = Replace(ziel,
"ß"
,
"ss"
)
ziel = Replace(ziel,
"ä"
,
"ae"
)
ziel = Replace(ziel,
"ü"
,
"ue"
)
ziel = Replace(ziel,
"ö"
,
"oe"
)
ziel = Replace(ziel,
"Ö"
,
"Oe"
)
ziel = Replace(ziel,
"Ä"
,
"Ae"
)
ziel = Replace(ziel,
"Ü"
,
"Ue"
)
"?origins="
& start & _
"&destinations="
& ziel & _
"&mode=driving&sensor=false&units=metric&key=MEINSCHLÜSSEL"
Set
oXH = CreateObject(
"msxml2.xmlhttp"
)
With
oXH
.Open
"get"
, surl,
False
.send
bodytxt = .responseText
End
With
bodytxt = Right(bodytxt, Len(bodytxt) - InStr(1, bodytxt,
"<text>"
) - 5)
tim_e = Left(bodytxt, InStr(1, bodytxt,
"</text>"
) - 1)
bodytxt = Right(bodytxt, Len(bodytxt) - InStr(1, bodytxt,
"<text>"
) - 5)
distanc_e = Left(bodytxt, InStr(1, bodytxt,
"</text>"
) - 1)
distanz = distanc_e
Set
oXH =
Nothing
End
Function