急!这个代码错在哪?
错误91,对象变量或with块变量未设置。是个填表自动化的问题。流程:1.第一个页面,只有submit进入下一页按钮,点击;2、进入第二个页面,填表,有q1和q2两项, 填表完毕后点击submit提交。Private Sub WebBrowser6_DocumentComplete(ByVal pDisp As Object, URL As Variant)
Dim tg5
Dim d5
Dim doc5 As String
Dim doctext
Dim i As Long
Set doctext = WebBrowser6.Document.body.createTextRange()
Set d5 = WebBrowser6.Document
doc5 = doctext.htmltext
For i = 0 To d5.All.length - 1
Set tg5 = d5.All(i)
If LCase(d5.All(i).tagName) = "input" Or LCase(d5.All(i).tagName) = "select" Then
If InStr(1, doc5, "开始") > 0 Then
If tg5.Type = "submit" Then
tg5.Click
End If
End If
If InStr(1, doc5, "signup/cc/page1") > 0 Then
If tg5.Type = "radio" Then
Select Case tg5.Name
Case "q1"
tg5.Value = "7"
Case "q2"
tg5.Value = "2"
End Select
ElseIf tg5.Type = "submit" Then
tg5.Click
End If
End If
End If
Next i
End Sub