METHOD DOCUMENT OF OBJECT IWEBBROWSER2 FAILED

HGZICA 28/08/2012 08:58:35
#408731
Bom dia, pessoal!

No VB6 quero inserir dados em um página web.
mais ta me retornando o seguinte erro:

[txt-color=#e80000]Run-time error [ô]-2147467259 (80004005)[ô]:
Method [ô]Document[ô] of object [ô]IWebBrowser2[ô] failed[/txt-color]

O script ta assim:

[txt-color=#0000f0]Private Sub teste()
Dim ie As Object
Dim ULogin As Boolean, ieForm
Dim C As Integer


Set ie = CreateObject([Ô]InternetExplorer.Application[Ô])
ie.Visible = True
ie.Navigate [Ô]http://site.com.br[Ô]
Do Until ie.ReadyState = READYSTATE_COMPLETE
Loop
For i = 0 To C
For Each ieForm In ie.Document.Forms
If InStr(ieForm.innerText, [Ô]Usuario[Ô]) <> 0 Then
ULogin = True
ieForm(2).Value = [Ô]123[Ô]
ieForm(3).Value = [Ô]123[Ô]
ieForm.submit
Do Until ie.ReadyState = READYSTATE_COMPLETE
Loop
ie.Navigate [Ô]http://site.com.br/teste[Ô]
End If
Next
Do Until ie.ReadyState = READYSTATE_COMPLETE
Loop
For Each ieForm In ie.Document.Forms
If InStr(ieForm.innerText, [Ô]CPF:[Ô]) <> 0 Then
ULogin = True
ieForm(2).Value = [Ô]01234567890[Ô]
ieForm(5).Value = [Ô]XXX[Ô]
ieForm(6).Value = [Ô]1234[Ô]
End If
Next
Next i
ULogin = False
Set ie = Nothing
End Sub[/txt-color]

Alguém pode me auxiliar a resolver isso?
MARCELO.TREZE 28/08/2012 10:12:48
#408746
qual é a linha que aponta este erro?
HGZICA 28/08/2012 10:16:13
#408749
essa aqui:
[txt-color=#0000f0]Private Sub teste()
Dim ie As Object
Dim ULogin As Boolean, ieForm
Dim C As Integer


Set ie = CreateObject([Ô]InternetExplorer.Application[Ô])
ie.Visible = True
ie.Navigate [Ô]http://site.com.br[Ô]
Do Until ie.ReadyState = READYSTATE_COMPLETE
Loop
For i = 0 To C[/txt-color]
[txt-color=#e80000]For Each ieForm In ie.Document.Forms[/txt-color]
[txt-color=#0000f0]If InStr(ieForm.innerText, [Ô]Usuario[Ô]) <> 0 Then
ULogin = True
ieForm(2).Value = [Ô]123[Ô]
ieForm(3).Value = [Ô]123[Ô]
ieForm.submit
Do Until ie.ReadyState = READYSTATE_COMPLETE
Loop
ie.Navigate [Ô]http://site.com.br/teste[Ô]
End If
Next
Do Until ie.ReadyState = READYSTATE_COMPLETE
Loop
For Each ieForm In ie.Document.Forms
If InStr(ieForm.innerText, [Ô]CPF:[Ô]) <> 0 Then
ULogin = True
ieForm(2).Value = [Ô]01234567890[Ô]
ieForm(5).Value = [Ô]XXX[Ô]
ieForm(6).Value = [Ô]1234[Ô]
End If
Next
Next i
ULogin = False
Set ie = Nothing
End Sub[/txt-color]
HGZICA 28/08/2012 12:59:23
#408769
resolvido!

substitui o...
[txt-color=#0000f0]Do Until ie.ReadyState = READYSTATE_COMPLETE
Loop[/txt-color]
por ...
[txt-color=#0000f0]Do While ie.Busy And Not ie.ReadyState = 4
DoEvents
Loop[/txt-color]
Tópico encerrado , respostas não são mais permitidas