excel vba - Run-time error '-2147467259, Automation error,Unspecified error VBA macro to logon through IE -


i experiencing such error whenever run vba macro logon automatically sugarcrm via ie.

code further below.

'needs references microsoft html object library , microsoft internet controls  option explicit  sub test()   const curl = "http://sam.selexgalileo.com/sugarcrm/index.php?action=login&module=users&login_module=accounts&login_action=index" const cusername = "robertopecora"    'replace xxxx user name const cpassword = "rp3c0r4!!"    'replace yyyy password  dim ie internetexplorer dim doc htmldocument dim loginform htmlformelement dim usernameinputbox htmlinputelement dim passwordinputbox htmlinputelement dim signinbutton htmlinputbuttonelement dim htmlelement ihtmlelement  set ie = new internetexplorer  ie.visible = true ie.navigate curl  'wait initial page load  while ie.readystate <> readystate_complete or ie.busy: doevents:  loop  set doc = ie.document  'get form on page  set loginform = doc.forms(0)  'get user name textbox , populate '< input name="ctl00$ct$username" type="text" maxlength="30" id="ctl00_ct_username" style="width:160px;" />  set usernameinputbox = loginform.elements("ctl00$ct$username") usernameinputbox.value = cusername  'get password textbox , populate '< input name="ctl00$ct$password" type="password" maxlength="30" id="ctl00_ct_password" style="width:160px;" />  set passwordinputbox = loginform.elements("ctl00$ct$password") passwordinputbox.value = cpassword  'get form input button , click '< input type="submit" name="ctl00$ct$uxbtnlogin" value="sign in" o n c l c k="javascript:webform_dopostbackwithoptions(new webform_postbackoptions("ctl00$ct$uxbtnlogin", "", true, "login", "", false, false))" id="ctl00_ct_uxbtnlogin" />  set signinbutton = loginform.elements("ctl00$ct$uxbtnlogin") signinbutton.click  'wait new page load  while ie.readystate <> readystate_complete or ie.busy: doevents: loop  'get html document of new page  set doc = ie.document  'determine whether login succeeded or not  if instr(doc.body.innertext, "invalid login information") = 0     msgbox "login succeeded" else     msgbox "login failed" end if  debug.print "current url: " & ie.locationurl   end sub 


Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -