No se que estoy haciendo mal pero el control de internet no vuelve para atras.. les dejo el proyecto es un bolazo, pero nose que pasa medio como qeu se tranca
Option Explicit
Sub Espera(Segundos As Single)
Dim ComienzoSeg As Single
Dim FinSeg As Single
ComienzoSeg = timer
FinSeg = ComienzoSeg + Segundos
Do While FinSeg > timer
DoEvents
If ComienzoSeg > timer Then
FinSeg = FinSeg - 24 * 60 * 60
End If
Loop
End Sub
Private Sub cmdparar_Click()
timer.Enabled = False
smsenviados.Text = 0
End Sub
Private Sub cmdrun_Click()
timer.Enabled = True
End Sub
Private Sub Form_Load()
Wb.Navigate ("http://www.fci.edu.uy/inscripcion.htm")
End Sub
Private Sub Timer_Timer()
Wb.Document.form1.Nombre.Value = txtnombre
Wb.Document.form1.apellido.Value = txtapellido
Wb.Document.form1.ctedad.Value = txtedad
Wb.Document.GetElementById("E-mail").Value = txtmail
Wb.Document.form1.telefono.Value = txttel
Wb.Document.form1.mensaje.Value = txtmensaje
Wb.Document.form1.enviar.Click
smsenviados.Text = smsenviados.Text + 1
Espera (5)
Wb.GoBack
End Sub
A simple vista no me doy cuenta si esta saliendo del loop?
Bueno, seguro que hay muchas formas de hacerlo, pero a mi se me ocurre ésta. Lo primero, declara una variable global (llamada por ejemplo, Terminado, que sea Boolean)
Es decir, en General Declarations
Dim Terminado As Boolean
Luego, al cargar el form añade esto
Terminado = False
Luego, en el evento NavigateComplete2 del WebBrowser, hacemos que vaya hacia atrás sólo si ya ha terminado. Para ello, al terminar de rellenar los datos, hacemos que Terminado sea igual a True.
Quedaría algo así:
Dim Terminado As Boolean
Option Explicit
Sub Espera(Segundos As Single)
Dim ComienzoSeg As Single
Dim FinSeg As Single
ComienzoSeg = Timer
FinSeg = ComienzoSeg + Segundos
Do While FinSeg > Timer
DoEvents
If ComienzoSeg > Timer Then
FinSeg = FinSeg - 24 * 60 * 60
End If
Loop
End Sub
Private Sub cmdparar_Click()
Timer.Enabled = False
smsenviados.Text = 0
End Sub
Private Sub cmdrun_Click()
Timer.Enabled = True
End Sub
Private Sub Form_Load()
Terminado = False
wb.Navigate ("http://www.fci.edu.uy/inscripcion.htm")
End Sub
Private Sub Timer_Timer()
wb.Document.Form1.Nombre.Value = txtnombre
wb.Document.Form1.apellido.Value = txtapellido
wb.Document.Form1.ctedad.Value = txtedad
wb.Document.GetElementById("E-mail").Value = txtmail
wb.Document.Form1.telefono.Value = txttel
wb.Document.Form1.mensaje.Value = txtmensaje
Terminado = True
wb.Document.Form1.enviar.Click
smsenviados.Text = smsenviados.Text + 1
Espera (5)
End Sub
Private Sub wb_NavigateComplete2(ByVal pDisp As Object, URL As Variant)
If Terminado = True Then
wb.GoBack
End If
Terminado = False
End Sub
Un saludo
No che no me funca de la manera esa , mira aca dejo el proyecto apra que lo veas bien no se que es aa :(
http://rapidshare.de/files/28825799/Proyecto.rar.html