Stupid question…
I keep getting an Exception AS OLEException (Exception code 0: Could not complete the operation due to error 80020101., (failed on “execScript”)) when I run my code to fill in a web field…
it’s probably because my webpage has not finished loading… so where should I run the code
Dim jsSrc As String
jsSrc = “window.status = (document.getElementById(”""+anElementID+""") != null);"
While mWaitElementByID
ExecuteJavaScript(jsSrc)
app.DoEvents(1)
Wend
[/code]
and in the StatusChanged event of the htmlviewer :
If mWaitElementByID then
mLastResult = newStatus
if newStatus="true" then
mWaitElementByID = False
end if
this way using anElementID as some element in the bottom of the web page, you wait until everything is loaded,
independently of the time it takes (different internet speed)
mWaitElementByID is a boolean property of the htmlviewer class
first section of the code is (for me) in a method I call WaitforelementbyID (anElementID as string)
I call this method when I have to wait for an element in the bottom of the web page.