2
I’m trying to download a table from the site: "http://www.scoutscartola.com/mercado", and I already "got". But there is a problem in my code. I want the user to define the team. This is done by selecting a combo box on the site, well, I even change the combo box data, but the table is not updated.
Down with the code so you can see what I’m talking about.
Sub navega_cartola_fc()
Dim ie As Object
Dim Nome As String
Set ie = New InternetExplorer
Nome = "Botafogo"
ie.navigate "http://www.scoutscartola.com/mercado"
ie.Visible = True
While ie.Busy: Wend
For Each obj In ie.Document.all.Item("data[filtro_time]")
If obj.innerText = Nome Then
obj.Selected = True
End If
Next obj
Dim r, c As Integer
Dim elemCol As Object
Set elemCol = ie.Document.getElementsByTagName("tbody")
Application.Wait TimeSerial(Hour(Now()), Minute(Now()), Second(Now()) + 3)
For r = 0 To elemCol(0).Rows.Length - 1
For c = 0 To elemCol(0).Rows(r).Cells.Length - 1
ActiveSheet.Cells(r + 1, c + 1) = elemCol(0).Rows(r).Cells(c).innerText
Next c
Next r
After correctly activating this combo box, excel should also change another combo box at the bottom of the site (one that says how many players want to filter, because this comes by default 25 and I would like to at least 100, not to risk staying player out of the search)...
Would anyone know what to do in this case? Because all the materials I see, the person changes the combo box as I did, but there is a button on the site itself that "updates" the data. But in this my case has no update button, the update is done so the team is selected in combo box - by the site - and this does not occur when I do by vba.
Welcome to the site. Some edits have been made to your question, in order to improve formatting and facilitate reading.
– user28595
Thank you. I even had identação. but when copying paste did not come. another error is in the first one where it says : "If obj.innerText = Link Then" should not = Link and yes = Name only that I have not yet learned to edit
– Clebson Omena
I just selected the text and clicked on the code formatting. But you are free to edit the question. Just click "edit". Take a look at the tools that appear at the top of the field where you type the text. They will help you format the content in the best way possible. And Happy 2017 :D.
– mau humor
It’s... I’m beginning to understand how the edition works. Thanks for the tip. And happy 2017 for you too.
– Clebson Omena