Excel VBA object required error with IE automation -


so have code go website , login. need go password change url. when run code, following error:

runtime error 424: object required

sometimes debugger says first getelementbyid statement, times says issue last 3 getelementbyid statements. code below:

 dim ie variant  dim strurl string  sub login()   set ie = new shdocvw.internetexplorer  ie.visible = true ie.navigate "https://minecraft.net/profile"  while ie.busy doevents wend  ie.document.getelementbyid("username").value = "ddd" ie.document.getelementbyid("password").value = "ddddddddddd"  dim htmlform htmlformelement set htmlform = ie.document.getelementbyid("loginform")  htmlform.submit ' ********************************************************************** 'ie.document.getelementbyid("username").value = "ddddd" ' ie.document.getelementbyid("password").value = "ddddd" ' ie.document.getelementbyid("signin").click '********************************************************************** 'pause while page loads   application.wait (now + #12:00:03 am#) ie.navigate "https://minecraft.net/profile/password"  ie.document.getelementbyid("oldpassword").value = "oldpass" ie.document.getelementbyid("password").value = "enwapss" ie.document.getelementbyid("passwordconfirmation").value = "enwapss"   set htmlform = ie.document.getelementbyid("loginform") htmlform.submit   end sub 

thanks in advance!

it may website isn't in ready state, in site hasn't loaded when it's attempting input values.

after

ie.navigate "https://minecraft.net/profile/password"

try adding

do until not ie.busy , ie.readystate = 4
doevents
loop

this loop until webpage has loaded similar, way you've done in above code

application.wait (now + #12:00:03 am#)


Comments