nianchi111
Board Regular
- Joined
- Aug 24, 2007
- Messages
- 197
- Office Version
- 365
Hi,
I have a macro which finds the link and opens and extract the data.I did this by getElementByID. The problem is in the website there is no ID it has only DIV Class. I'm unable to get the data.
Data Required
Sleeps 2/4 (1 Bedroom)
£200
Property Ref C797
Dave Holcroft
Tel: (UK) + 44 (0)7939 002417
Website:http://www.ownersdirect.co.uk/canaries/C797.htm
I have a macro which finds the link and opens and extract the data.I did this by getElementByID. The problem is in the website there is no ID it has only DIV Class. I'm unable to get the data.
Code:
Sub Gooney_Goo_Goo()
Dim ie As Object
Dim i As Long
Set ie = CreateObject("InternetExplorer.Application")
With ie
.Visible = True 'Just for our test
.Navigate "http://www.ownersdirect.co.uk/search_results.asp?specific_location_vchar=tenerife&action.x=30&action.y=13&action=search&class=advanced&arrival_offset_int=-1"
Do While .readyState <> 4: DoEvents: Loop
Do While .busy: DoEvents: Loop
With .Document
For i = 0 To .Links.Length - 1
If InStrB(1, .Links(i).innerText, "Apartment in Playa De Las Americas, Tenerife") Then
ie.Navigate .Links(i).href
Do While ie.readyState <> 4: DoEvents: Loop
Do While ie.busy: DoEvents: Loop
Exit For
End If
Next i
End With
End With
If ie.Document.getElementById("content").innerText <> "" Then
Dim lines As Variant, y As Integer
lines = Split(ie.Document.getElementById("content").innerText, vbCrLf)
For y = LBound(lines) To UBound(lines)
ActiveSheet.Cells(1, y + 3) = lines(y)
Next
End If
ie.Quit
End Sub
Data Required
Sleeps 2/4 (1 Bedroom)
£200
Property Ref C797
Dave Holcroft
Tel: (UK) + 44 (0)7939 002417
Website:http://www.ownersdirect.co.uk/canaries/C797.htm