程序在windows2000下正常 在windows2003下一运行就
提示 " For i = 0 To vDoc.All.length - 1" 错误
load事件中没有WebBrowser1.Navigate "http://127.0.0.1/index.htm"Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
Dim vDoc, vTag
Dim i As Integer
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" Or vTag.Type = "password" Or vTag.Type = "hidden" Then
Select Case vTag.Name
Case "Name"
vTag.Value = txtUserName.Text
Case "T"
vTag.Value = "Form Soft_IE"
Case "Password"
vTag.Value = txtPassword.Text
End Select
End If
Next i
End Sub
提示 " For i = 0 To vDoc.All.length - 1" 错误
load事件中没有WebBrowser1.Navigate "http://127.0.0.1/index.htm"Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
Dim vDoc, vTag
Dim i As Integer
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" Or vTag.Type = "password" Or vTag.Type = "hidden" Then
Select Case vTag.Name
Case "Name"
vTag.Value = txtUserName.Text
Case "T"
vTag.Value = "Form Soft_IE"
Case "Password"
vTag.Value = txtPassword.Text
End Select
End If
Next i
End Sub
你可以通过判断pDisp是否是浏览器对象来判断页面是否下载完成
Set vTag = vDoc.All(i)
If vTag
.....
End if
老兄,你少了一个End if 怎么可能运行正常