Hi
I state the code like this but it doesn't work, in fact it show an error
Code:
Sub Key()
'On Error GoTo KeyErr
Dim email As String
Dim Password As String
email = DLookup("[Usermail]", "[License_tbl]")
Password = DLookup("[UserPassword]", "[License_tbl]")
' open IE, navigate to the desired page and loop until fully loaded
Set IE = CreateObject("InternetExplorer.Application")
my_url = "https://mail.ionos.mx/"
IE.Visible = 1
'apiShowWindow IE.hwnd, SW_MAXIMIZE
apiShowWindow IE.hwnd, SW_SHOWMINIMIZED
With IE
.Visible = True
.Navigate my_url
Do Until Not IE.Busy And IE.ReadyState = 4
DoEvents
Loop
End With
' Input the userid and password
IE.Document.getElementById("login-form-user").Value = email
IE.Document.getElementById("login-form-password").Value = Password
' Click the "login" button
IE.Document.getElementsByTagName("button")(0).Click
Do Until Not IE.Busy And IE.ReadyState = 4
DoEvents
Loop
If InStr(IE.Document.getElementById("notification-description").Value, "La contraseña introducida no es correcta o no existe") > 0 Then
'wrong password - display custom message and exit
MsgBox "License expired", vbInformation, "Q-Sys Quality Management Tool"
Else
'login OK
MsgBox "License on time", vbInformation, "Q-Sys Quality Management Tool"
End If
'IE.Quit
' MsgBox "Conexion exitosa", vbInformation, "Q-Sys Quality Management Tool"
Exit Sub
'KeyErr:
'IE.Quit
'MsgBox "Valide su conexión a internet", vbExclamation, "Q-Sys Quality Management Tool"
'Exit Sub
End Sub