【发布时间】:2019-04-02 07:53:38
【问题描述】:
我的想法是制作一个(忘记密码)表单,该表单将恢复(用户名)和(密码)并通过用户提供的电子邮件地址发送。在下图中,客户将输入他的电子邮件地址,因此程序代码将在隐藏的工作表中找到与电子邮件地址完全匹配的内容,如果匹配,则接下来的两个单元格将存储为字符串。
正如您在下面看到的,这是一个隐藏的表格,其中包含一个包含有关注册客户的信息的表格,因此当我们收到与(用户名)和(密码)匹配的电子邮件时,将存储为字符串((!!无需激活或看到这张纸!!))
这是我当前的代码:
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
这是我要修改的代码:
' ========(( 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
【问题讨论】:
-
酷仪表板!
-
@BOB 谢谢!很高兴你喜欢它
-
我建议你在截图中隐藏那些电子邮件和密码,以防万一。
-
@FoxfireAndBurnsAndBurns 感谢您的关心,它甚至不是真正的密码,只是随机的
标签: excel vba string forgot-password