charly.csh
New member
- Local time
- Yesterday, 21:56
- Joined
- May 7, 2020
- Messages
- 9
Hello everyone,
I am doing a module to connect with an email account. I am using this as a license to avoid the usage of my Access app after a time as well to control this just changing the password from the website from home and not necessary being physically on the site where this is installed
I have the first part completed to connect with the elements of the website, but the issue is that if the password works or not the event is running anyway and it's opening the app
I would like to get that to by two ways.. (any of both)
1. If the password works login in to the email and inmediatly sign-out and close the explorer
2. If the password doesn't work just trig the messagebox "with license is over"
Enclosed you can find the example I made (until I could) and I create an account for testing. The website is https:/ mail.ionos.mx
I really appreciate your help!!!
Thanks in advance!!!
I am doing a module to connect with an email account. I am using this as a license to avoid the usage of my Access app after a time as well to control this just changing the password from the website from home and not necessary being physically on the site where this is installed
I have the first part completed to connect with the elements of the website, but the issue is that if the password works or not the event is running anyway and it's opening the app
I would like to get that to by two ways.. (any of both)
1. If the password works login in to the email and inmediatly sign-out and close the explorer
2. If the password doesn't work just trig the messagebox "with license is over"
Enclosed you can find the example I made (until I could) and I create an account for testing. The website is https:/ mail.ionos.mx
I really appreciate your help!!!
Thanks in advance!!!
Code:
Option Compare Database
Declare PtrSafe Function apiShowWindow Lib "user32" Alias "ShowWindow" _
(ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Global Const SW_MAXIMIZE = 3
Global Const SW_SHOWMINIMIZED = 2
Global Const SW_SHOWNORMAL = 1
Sub Key()
'On Error GoTo KeyErr
Dim email As String
Dim Password As String
email = DLookup("[UsuarioCorreo]", "[Licencia_tbl]")
Password = DLookup("[UsuarioPassword]", "[Licencia_tbl]")
' open IE, navigate to the desired page and loop until fully loaded
Set IE = CreateObject("InternetExplorer.Application")
my_url = "https:/ mail.ionos.mx" 'This page doesn't leave me to put it here but enclosed you can find the example
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
If InStr(IE.Document.getElementById("notification-description").Value, "La contraseña introducida no es correcta o no existe la dirección de e-mail.") > 0 Then
MsgBox "wrong password"
Else
'IE.Quit
MsgBox "Conexion exitosa", vbInformation, "Q-Sys Quality Management Tool"
End If
Exit Sub
KeyErr:
IE.Quit
MsgBox "Validate Internet connection", vbExclamation, "App"
Exit Sub
End Sub
Attachments
Last edited: