1. 程式人生 > >VB登陸163郵箱

VB登陸163郵箱

新增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