VBA automation error: -2125463506 (8150002e)

bunburyst

New Member
Joined
Apr 18, 2018
Messages
7
Hey guys!

I have a problem with my VBA code to login a website. Sometimes it works perfectly, but other times i get automation error: 2125463506 (8150002e).




My OS is Windows 10. In windows 7 i didnt get this error.


Can anyone have a look an tell me how I must have the macro?
Any help is appreciated. Thanks:

Code:
Dim HTMLDoc As HTMLDocumentDim MyBrowser As InternetExplorer
 Sub Repsol1()


 Dim MyHTML_Element As IHTMLElement
Dim MyURL As String
Dim form As HTMLFormElement
    MyURL = "https://login.repsol.com/es/Landing/AuthnPage?returnUrl=https://www.repsol.com/es_es/"
    Set MyBrowser = New InternetExplorer
    MyBrowser.Silent = True
    MyBrowser.Navigate MyURL
    MyBrowser.Visible = True
    Do
        DoEvents
    Loop Until MyBrowser.ReadyState = READYSTATE_COMPLETE
 
    Set HTMLDoc = MyBrowser.Document


    Do While HTMLDoc.getElementById("gigya-login-form") Is Nothing
        DoEvents
    Loop


    Set form = HTMLDoc.getElementById("gigya-login-form")


    form.all.UserName.Value = "aperson@somecompany.com"
    form.all.Password.Value = "password"
   
 
    form.getElementsByClassName("gigya-input-submit")(0).Click


Do
 Loop Until MyBrowser.ReadyState = READYSTATE_COMPLETE
 With CreateObject("InternetExplorer.Application")
        .Visible = True
        .Navigate "https://www.repsol.com/es_es/aplicaciones/SO/WebEESS/default.aspx?usuario=g0021581"
End With

End Sub
[COLOR=#333333]
[/COLOR]


Error debug: code line "
Set MyBrowser = New InternetExplorer"






 
Last edited by a moderator:

bunburyst

New Member
Joined
Apr 18, 2018
Messages
7
Thanks for your answer but it does not work.

Before starting the macro I tried to kill the "iexplorer.exe" process and it works, but I would like to find another solution.
On the other hand, sometimes the VBA code does not load the user and the password, "Run-time error 91 Object variable or With block variable not set".

¿?¿? :(
 
Last edited:

John_w

MrExcel MVP
Joined
Oct 15, 2007
Messages
6,001
I tried your code and it loaded the page and populated the username and password fields.

I've seen this automation error occasionally. The fix is usually to kill all the iexplore.exe (not iexplorer.exe) processes and, if it exists, the ielowutil.exe process, and run the code again.

To fix the error 91 try:
Code:
    Do
        Set form = HTMLDoc.getElementById("gigya-login-form")
        DoEvents
    Loop While form Is Nothing
 

ercedwards

Board Regular
Joined
Apr 27, 2013
Messages
118
I may be late but I've had that 8150002e issues for a while.

I seem to have just solved it by putting this line in just before the set ie= line

[FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]Call Shell("cmd.exe taskkill /F /IM /c iexplore.exe")

Hope this helps even though it took so long
[/FONT]
 

Forum statistics

Threads
1,082,632
Messages
5,366,678
Members
400,913
Latest member
SarahMS1

Some videos you may like

This Week's Hot Topics

Top