I am struggling to make a http request for each item of an array in VBA. When I make the request for a single object there is no problem:
But when I try and use the request method for each item in an array I get the error: '-2147024809 (80070057)'.
I can't find anything useful online for the error code.
The code below is throwing the error.
I have tested the url1 string for each item in the array before the http request and these are valid strings for the request, so I believe the problem is my code for making the multiple requests.
I am unsure if I need to set an array for the xml_obj. Can anyone help please?
VBA Code:
Dim xml_obj As MSXML2.XMLHTTP60
Set xml_obj = New MSXML2.XMLHTTP60
xml_obj.Open bstrMethod:="GET", bstrURL:=url1
xml_obj.send
But when I try and use the request method for each item in an array I get the error: '-2147024809 (80070057)'.
I can't find anything useful online for the error code.
The code below is throwing the error.
VBA Code:
Dim url1(1 To 5) As String
Dim xml_obj As MSXML2.XMLHTTP60
Set xml_obj = New MSXML2.XMLHTTP60
For i = 1 To UBound(url1)
xml_obj.Open bstrMethod:="GET", bstrURL:=url1(i) ' error thrown on this line
xml_obj.send
Next i
I have tested the url1 string for each item in the array before the http request and these are valid strings for the request, so I believe the problem is my code for making the multiple requests.
I am unsure if I need to set an array for the xml_obj. Can anyone help please?