DB73
Board Regular
- Joined
- Jun 7, 2022
- Messages
- 107
- Office Version
- 365
- 2021
- 2019
- 2016
- 2010
- 2007
- Platform
- Windows
- Mobile
- Web
Hi all,
i found an excel file on the www what i can use for my master file.
the file that i found is a distance calculator via google maps.
it is working and i got the API key.
the problem is, as i copied everything to my masterfile it gives the following fault:
Compile error: Undefind variable
someting wrong in;
it doesnt seem to work after copying everything
also, i dont know what the "MSXML2.XMLHTTP60" is/means.
someone an idea
tx in advance
i found an excel file on the www what i can use for my master file.
the file that i found is a distance calculator via google maps.
it is working and i got the API key.
the problem is, as i copied everything to my masterfile it gives the following fault:
Compile error: Undefind variable
VBA Code:
Function gDist(strOrig, strDest, strAPI, strMode, strReg)
Dim strURL As String
Dim objHttp As MSXML2.XMLHTTP60
Dim objDom As DOMDocument60
Dim aryDest() As String
If Len(strReg) > 0 Then
strRegURL = "®ion=" & strReg
End If
strURL = "https://maps.googleapis.com/maps/api/distancematrix/xml?units=imperial" & _
"&origins=" & strOrig & _
"&destinations=" & strDest & _
"&traffic_mode1=optimistic" & _
"&mode=" & strMode & _
strRegURL & _
"&key=" & strAPI
Set objHttp = MSXML2.XMLHTTP60
With objHttp
.Open "GET", strURL, False
.setRequestHeader "Content-Type", "application/x-www-form-URLEncoded"
.Send
End With
Set objDom = New DOMDocument60
objDom.LoadXML (objHttp.responseText)
someting wrong in;
VBA Code:
MSXML2.XMLHTTP60
also, i dont know what the "MSXML2.XMLHTTP60" is/means.
someone an idea
tx in advance