I have code which picks up data from multiple columns from ThisWorkbook and puts in various field in website in internet explorer. The website loads after clicking on <
Use proper page load waits after each .Navigate
and .Click
.
While ie.Busy Or ie.readyState < 4: DoEvents: Wend
Also, you can wrap elements that are throwing errors, related to timings, in timed loops which attempt to set the object reference
Dim t As Date, ele As Object
Const MAX_WAIT_SEC As Long = 10
t = Timer
Do
On Error Resume Next
Set ele = doc.getElementById("ContentPlaceHolder1_GridView1_chkboxSelectAll")
On Error GoTo 0
If Timer - t > MAX_WAIT_SEC Then Exit Do
Loop While ele Is Nothing
If Not ele Is Nothing Then
ele.Click
End If