添加2个text,一个command,一个 WebBrowser
Dim vDoc,vTag
Dim i As Integer
Private Sub Command1_Click()
Set vDoc = WebBrowser1.Document
For i = 0 To vDoc.All.length - 1
If UCase(vDoc.All(i).tagName) = "INPUT" Then
Set vTag = vDoc.All(i)
If vTag.Type = "text" Then
Select Case vTag.Name
Case "username"
vTag.Value = Text1 '用户名
End Select
End If
If vTag.Type = "password" Then
Select Case vTag.Name
Case "password"
vTag.Value = Text2 '密码
End Select
End If
If vTag.Name = "remUser" Then '如果不要记住用户名,此句删除
vTag.Click
End If
If vTag.Type = "submit" Then '如果不要点击按钮登陆,把此if的代码删除
vTag.Click
End If
End If
Next i
End Sub
Private Sub Form_Load()
WebBrowser1.Navigate "http://mail.163.com/" End Sub