1个回答
展开全部
给你个例子吧: Do While brow.Busy Application.DoEvents() Loop Public Sub fill() On Error Resume Next Do While brow.Busy Application.DoEvents() Loop Dim webDoc As Object = brow.Document.all Dim webTag As Object Dim lengthTag As Integer = webDoc.length - 1 For countTag As Integer= 0 To lengthTag webTag = webDoc.item(countTag) Select Case Strings.LCase(webDoc.item(countTag).tagname) Case "textarea" '网页中的文本框 Select Case webTag.name Case "body" '"body"来自网页源代码,不同网站很可能不同,你根据实际修改。下同。 webTag.value = strBody '这是预先定义的值,下同。 End Select Case "select" '网页中的下拉选择框 Select Case webTag.name Case "month" '选择月份,这里略去年、日的选择,因为原理相同。 webTag.all.item(1).selected = True '选择第一个值 End Select Case "input" '网页中的输入框 Select Case Strings.LCase(webTag.type) Case "text" '文本 Select Case webTag.name Case "name", "userid", "nickname" '用户名 webTag.value = strName Case "subject" '标题 webTag.value = strSubject Case "regid" '注册码 webTag.value = strRegid Case "username", "realname" webTag.value = strUsername Case "cardnumber" webTag.value = strCardNumber Case "homephone" webTag.value = strHomephone '电话号 Case "url_title" '链接名称 webTag.value = urlTitle Case "url" '链接 webTag.value = url Case "email" 'email地址 webTag.value = email Case "img" '图片 webTag.value = img Case "midi" '音乐 webTag.value = midi Case "year" '年 webTag.value = strYear Case "prompt" '找回密码提示问题 webTag.value = strPrompt Case "answer" '找回密码答案 webTag.value = strAnswer End Select Case "password" '密码 Select Case webTag.name Case "passwd", "password", "confirm", "repasswd" '密码,确认密码 webTag.value = strPass End Select Case "checkbox" '单选框 Select Case webTag.name Case "emailme" 'email通知我 webTag.checked = True End Select End Select End Select Next brow.Document.forms(0).submit() '许多网页表单,这一句简单代码即实现自动提交 End Sub Public Sub autoAdd() brow.Silent = True '不弹出窗口 brow.Navigate(" http://www.yourURL.com/" ) '打开指定页 Do While formBrowNetsh.brow.Busy '等待网页加载完毕 Application.DoEvents() Loop Call fill() End Sub
记得采纳啊
记得采纳啊
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询