My idea is to make a (Forget Password) form that will restore the (Username) & (Password) and send it via Email Address provided by the user. In the following picture the customer will enter his Email address so the procedure code will find an exact match of the Email Address in hidden sheet table, if there is a match the next two cells will be stored as a string.
As you can see down below this is the hidden sheet with a table that contains information about registered customers, so when we get Email matching the (Username) and (Password) will be stored as string ((!!without activating or seeing this sheet!!))
This is my current code:
Public Function send_email()
Dim NUser As String
Dim NPass As String
Dim info As Variant
Set cdomsg = CreateObject("CDO.message")
With cdomsg.Configuration.Fields
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
.Item("http://schemas.microsoft.com/cdo/configuration/smptserverport") = "587"
.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "dash32762@gmail.com"
.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "*******"
.Update
End With
' ========(( below is the code i want to find and store user and pass ))
Set info = Worksheets("AdminPanel2").Range("I11:I80").Find( _
What:=Me.txt_pass.Value, LookIn:=xlFormulas)
If Not info Is Nothing Then
info.Parent.Activate
info.Offset(0, 1).Select
NUser = ActiveCell.Text
MsgBox "That data was sent"
Else
MsgBox "That data was not found."
End If
'===========(( below code i want to recall it in body of the email ))
With cdomsg
.To = info
.From = "dash32762@gmail.com"
.Subject = "Restore information"
.TextBody = Hello youur username is NUser your password is NPass
.send
End With
Set cdomsg = Nothing
End Function
This is the code I want to modify:
' ========(( below is the code i want to find and store user and pass ))
Set info = Worksheets("AdminPanel2").Range("I11:I80").Find( _
What:=Me.txt_pass.Value, LookIn:=xlFormulas)
If Not info Is Nothing Then
info.Parent.Activate
info.Offset(0, 1).Select
NUser = ActiveCell.Text
MsgBox "That data was sent"
Else
MsgBox "That data was not found."
End If