rpjd99
Colt
Thanks, Kev. Your timing is impeccable, as you are aware! Haven't tried it yet, but will be doing so in the next few days.this may help point you in the right direction
Ray
Thanks, Kev. Your timing is impeccable, as you are aware! Haven't tried it yet, but will be doing so in the next few days.this may help point you in the right direction
That's the problem with visual basic: there are too many varieties. And the VB in Visual Studio is different to the VB in Visual Basic for Applications (VBA). I was never happy in Visual Studio and I recently ported the excellent tutorial ofI've given the code a go but it's not ininteracting with the code of my scraper.
HiCan I ask, when you run your scraper do you have a session of internet explorer open?
Function GetSource(sURL As String) As String
'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
'By Tim Williams
'Downloads an http page with an address "sURL" and stores it in "GetSource" as a string.
'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Dim rpt As Integer
Dim oXHTTP As Object
Set oXHTTP = CreateObject("MSXML2.XMLHTTP")
'Counter for the number of attempts made if repeated errors occur with the "oXHTTP.send" instruction
rpt = 0
GetDoc:
On Error GoTo ErrorTrap
oXHTTP.Open "GET", sURL, False
oXHTTP.send
On Error GoTo 0
GetSource = oXHTTP.responseText
Set oXHTTP = Nothing
Exit Function
ErrorTrap:
'Increment the try counter
rpt = rpt + 1
'Allow three attempts
If rpt < 3 Then
'Wait 2 seconds and try again
If Application.Wait(Now + TimeValue("0:00:02")) Then Resume GetDoc
'Three failed attempts have been made so return to the line ("oXHTTP.send") to halt the macro with an error
Else: Resume
End If
End Function
HiWell I've a cookie aware client, overridden the web request and web response, saved the cookie container from the response to ue on the next request and it still bloody doesn't work. The other thing that is possible is the rp site is using JavaScript to change something.
mlmrob
I have this in my database - I'll try to post up an Excel version this evening/tomorrow.
atb
Kev