Marc L
Excel Ninja
Thanks !
Yes it's better to release from memory all variables objects
by setting them to Nothing before procedure exit …
For readers, previous code use early binding for request object,
reference Microsoft XML 6.0 checked within project.
From previous code, a demontration to extract only names
with filled emails in late binding way (no need any reference) :
Yes it's better to release from memory all variables objects
by setting them to Nothing before procedure exit …
For readers, previous code use early binding for request object,
reference Microsoft XML 6.0 checked within project.
From previous code, a demontration to extract only names
with filled emails in late binding way (no need any reference) :
Code:
Sub Demo2()
Const URL = "http://www.sportfocus.com/comdir/morekeywords.cfm?cid=11&maj=cricket&ckid=102&min=clubs and Associations&kid=860&key=England"
With CreateObject("Msxml2.XMLHTTP")
.Open "POST", URL, False
.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
.setRequestHeader "DNT", "1"
.send "type=name&rowlimit=999&count=1"
SPQ = Split(.responseText, "<dt><a href=")
End With
If UBound(SPQ) > 0 Then
ReDim VA$(1 To UBound(SPQ), 1)
For R& = 1 To UBound(SPQ)
SP = Split(SPQ(R), "<a href=""mailto:")
If UBound(SP) > 0 Then
L& = L& + 1
VA(L, 0) = Split(Split(SP(0), ">")(1), "<")(0)
VA(L, 1) = Split(SP(1), """")(0)
End If
Next
ActiveSheet.UsedRange.Offset(1).Clear
[A2].Resize(L, 2).Value = VA
End If
End Sub
VA$() means VA() As String
R& is same as R As Long
To see in VBA inner help in variables types but
it is easier to use Dim statement in top of procedure …
R& is same as R As Long
To see in VBA inner help in variables types but
it is easier to use Dim statement in top of procedure …