shahin
Active Member
I've written some code in vba in combination with IE. The code I've pasted below is working great. However, it works as long as I keep the "Application.Wait (Now + TimeValue("0:00:05"))" line how it is. I was thinking of executing the code successfully without using that hardcoded delay in my script. Any loop or something will do instead.
Code:
Sub Get_Result()
Dim IE As New InternetExplorer, html As HTMLDocument
With IE
.Visible = False
.navigate "https://greenbet.info/en/display/fortune"
Do Until .readyState = READYSTATE_COMPLETE: Loop
Set html = .document
End With
Application.Wait (Now + TimeValue("0:00:05")) ''wanted to kick this out
For Each posts In html.getElementsByClassName("fortune_roulette")
row = row + 1: Cells(row + 1, 1) = posts.getElementsByClassName("fortune_round__num")(0).innerText
Cells(row + 1, 2) = posts.getElementsByClassName("second_digit")(0).innerText
Cells(row + 1, 3) = posts.getElementsByClassName("first_digit")(0).innerText
Next posts
End Sub