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:
Error debug: code line "Set MyBrowser = New InternetExplorer"
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: