vba - Automation error when getting ReadyState of InternetExplorer object -
vba - Automation error when getting ReadyState of InternetExplorer object -
i 2 different errors on same line. one:
automation error: object invoked has disconnected clients
and sometimes:
the interface unknown
minimal code reproduce error:
sub mcve() dim ie object dim www string set ie = new internetexplorermedium www = "http://www.stackoverflow.com" ie.navigate www ie.visible = false while ie.readystate <> 4 ' <~~~~~~~~~~~~~~~~~~~~~~~~ error occurs here doevents wend end sub
this requires reference: tools > references... > microsoft net controls
the error occurs on while ie.readystate <> 4
sec time. how prepare this?
instead of
set ie = new internetexplorermedium
just utilize
set ie = new internetexplorer
or, late binding:
set ie = createobject("internetexplorer.application")
this makes error go away.
i'm not sure why utilize internetexplorermedium
in first place. quoting little print in the documentation:
remarks
windows net explorer 8. on windows vista, create an instance of net explorer running @ medium integrity level, pass clsid_internetexplorermedium
(defined in exdisp.idl) cocreateinstance
. resulting internetexplorermedium
object supports same events, methods, , properties internetexplorer
object.
are using ie8 on windows vista, , want "medium integrity level", whatever means? didn't think so.
vba internet-explorer excel-vba
Comments
Post a Comment