Hello all,
What im trying to do is a basic web scraper in VBA. At this point i `ve made a script that does what i need , except ... LOOP.
My code is bellow. Im not violating the copyright , as there is no username or password envolved ... nor any copyright written or accepted .
In the Sheet1 , i have all the Id`s for make and models as well as all the other selection in the "E "column.
what i deed is , that For each row in the sheet1 , to run the script and return data.
Any help will be apreciated.
Sub Macro1()'
' Macro1 Macro
'
'Open the URL
Dim IE As Object
Set IE = CreateObject("internetexplorer.application")
IE.Navigate "http://www.ebc-brakes.de/start.php4?&page=navi_shop&Shop=1"
IE.Visible = True 'Can be false/hidden
'Wait for the page to finish loading
Do While IE.Busy Or IE.ReadyState <> 4
DoEvents
Loop
IE.Document.getElementById("MARKE").Focus
IE.Document.getElementById("MARKE").selectedIndex = Sheets("Sheet1").Range("A2")
IE.Document.getElementById("MARKE").FireEvent ("onchange")
Do While IE.Busy Or IE.ReadyState <> 4
DoEvents
Loop
IE.Document.getElementById("MODELL").Focus
IE.Document.getElementById("MODELL").selectedIndex = Sheets("Sheet1").Range("C2")
IE.Document.getElementById("MODELL").FireEvent ("onchange")
Do While IE.Busy Or IE.ReadyState <> 4
DoEvents
Loop
Dim link As Object
For Each link In IE.Document.Links
Debug.Print link.innertext
Next link
Set doc = IE.Document
For Each link In IE.Document.Links
If link.innertext = Sheets("Sheet1").Range("E2") Then link.Click
Next link
Do While IE.Busy Or IE.ReadyState <> 4
DoEvents
Loop
Dim data
data = IE.Document.body.innertext
Sheets("Sheet2").Range("A1") = data
End Sub
Bookmarks