VB 自动登录网页,不要用webbrowser控件,登录的是系统默认浏览器。。。

来源:百度知道 编辑:UC知道 时间:2024/06/21 14:19:30
VB 自动登录网页,不要用webbrowser控件,登录的是系统默认浏览器。。。

前一阵在做淘宝网的东东,贴一个用IE登录淘宝网的
Option Explicit

Sub GotoTaoBao(uid As String, pwd As String)

With CreateObject("InternetExplorer.Application")
.Visible = True
.Navigate "http://auction1.taobao.com/auction/view_personal_sale_item.jhtml?view_type=viewsold"
Do Until .ReadyState = 4
DoEvents
Loop
.Document.Forms(0).All("TPL_username").Value = uid
.Document.Forms(0).All("TPL_password").Value = pwd
.Document.Forms(0).All("Submit").Click
End With

End Sub

Private Sub Command1_Click()
GotoTaoBao "youID", "youPwd"
End Sub

不用CreateObject的话,要引用Microsoft Internet Controls (shdocvw.dll)
然后声明一个Inter