Hello everybody,
this code was working fine on my other system, but when I try to use this on a different system, am getting "Run-time error '5': Invalid procedure call or argument",
Sub test()
Dim rng, lr As Long, a, res As String, x As Long
lr = Cells(Rows.Count, 1).End(xlUp).Row
rng = Range("a2:b" & lr)
For x = LBound(rng) To UBound(rng)
With CreateObject("MSXML2.XMLHTTP")
.Open "GET", rng(x, 1), False
.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
.send rng(x, 1)
a = Split(.responsetext, "userbody")(1)
res = WorksheetFunction.Clean(Left(a, InStr(a, "<!") - 1))
If InStr(res, "<h5>") Then
res = Left(res, InStr(res, "<h5>") - 1)
End If
rng(x, 2) = Replace(Replace(Replace(Replace(res, Chr(34) & ">", vbNullString), "<br>", Chr(10)), "</h2>", vbNullString), "<h2>", vbNullString)
End With
Next
Range("a2:b" & lr) = rng
End Sub
I have colored red where i get this error, any help is greatly appreciated.
Thanks in Advance
Bookmarks