Saltar al contenido
View in the app

A better way to browse. Learn more.

Ayuda Excel

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Pausar macro mientras internet explorer trabaja

publicado

Buenas tardes a todos.

En esta macro:

Public Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long
Public Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
Public Const MOUSEEVENTF_LEFTDOWN = &H2
Public Const MOUSEEVENTF_LEFTUP = &H4
Public Const MOUSEEVENTF_RIGHTDOWN As Long = &H8
Public Const MOUSEEVENTF_RIGHTUP As Long = &H10
Sub ABRIR_IE()
Dim IE As Object
Set IE = CreateObject("InternetExplorer.Application")
IE.Navigate "http://www.paginaweb.html"
While IE.Busy
DoEvents
Wend
IE.Visible = True
DoEvents
Application.ScreenUpdating = False
Sheets("Hoja1").Visible = True
Sheets("Hoja2").Visible = True
Application.WindowState = xlMinimized 'minimizar excel
Application.Wait Time + TimeSerial(0, 0, 14)
SetCursorPos 900, 581 'Boton aceptar informacion
mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0
mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
Application.Wait Time + TimeSerial(0, 0, 3)
If Sheets("Controlados").Range("r2") = "MANUAL" Then
SetCursorPos 747, 500 'Boton entrada manual
mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0
mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
Application.Wait Time + TimeSerial(0, 0, 3)
SendKeys "XXXXXXX{tab}XXXXXX{tab}~", True
Application.Wait Time + TimeSerial(0, 0, 3)
SendKeys "XXXXXXXX{tab}~", True
Application.Wait Time + TimeSerial(0, 0, 1)
SendKeys "~", True
Application.Wait Time + TimeSerial(0, 0, 2)
SendKeys "~", True
Else
SetCursorPos 821, 406 'Boton entrada tarjeta
mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0
mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
Application.Wait Time + TimeSerial(0, 0, 12)
SendKeys "~"
Application.Wait Time + TimeSerial(0, 0, 10)
SendKeys "XXXXXXXX~", True
Application.Wait Time + TimeSerial(0, 0, 4)
SendKeys "~", True
Application.Wait Time + TimeSerial(0, 0, 2)
End If
Application.Wait Time + TimeSerial(0, 0, 12)
SetCursorPos 947, 66 'x Maximizar ventana
mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0
mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
Application.Wait Time + TimeSerial(0, 0, 10)
SetCursorPos 66, 112 'Boton
mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0
mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
Application.Wait Time + TimeSerial(0, 0, 10)
SetCursorPos 126, 184 'Boton hoy
mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0
mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
Application.Wait Time + TimeSerial(0, 0, 7)
If Sheets("Controlados").Range("I2") = "NO" Then
SetCursorPos 1236, 291
mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0
mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
Else
SetCursorPos 1236, 315 'Señalar
mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0
mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
End If
Application.Wait Time + TimeSerial(0, 0, 1)
SetCursorPos 145, 717 'Boton modificar
mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0
mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
Application.Wait Time + TimeSerial(0, 0, 10)
SetCursorPos 583, 187 'Boton comentarios
mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0
mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
Application.Wait Time + TimeSerial(0, 0, 7)
Sheets("Controlados").Range("a31").Copy
SetCursorPos 387, 337 'Señalar comentarios
mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0
mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
Application.Wait Time + TimeSerial(0, 0, 1)
SendKeys "^v"
SetCursorPos 290, 642
mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0
mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0
mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
Application.Wait Time + TimeSerial(0, 0, 1)
Sheets("Controlados").Range("m2").Copy
SendKeys "^v"
Application.Wait Time + TimeSerial(0, 0, 1)
SendKeys "{tab}"
Sheets("Controlados").Range("a6").Copy
SendKeys "^v"
Application.Wait Time + TimeSerial(0, 0, 1)
SendKeys "{tab}"
Sheets("Controlados").Range("m6").Copy
SendKeys "^v"
Application.Wait Time + TimeSerial(0, 0, 1)
SetCursorPos 54, 722 'Boton guardar
mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0
mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
Sheets("Hoja1").Visible = False
Sheets("Hoja2").Visible = False
Application.ScreenUpdating = True
End Sub[/CODE]

Me logueo en una pagina web. Es un servlet y utilizo este metodo, porque segun he mirado no hay metodo post para javascript.

Mi problema es que utilizo una intranet, y la velocidad de navegacion depende mucho de los ordenadores que haya conectados, por lo que el metodo de hacer pausas, (aunque doy bastante tiempo) a veces me falla y ya se descuadra toda la macro.

Estoy mirando

While IE.readyState <> READYSTATE_COMPLETE: DoEvents: Wend

Lo que intento es pausar la macro y que no continue hastaque cargue la pagina, o si pulso un boton, que acabe de salir otra ventana donde debo ingresar datos y no tener que hacerlo a ojo con

Application.Wait Time + TimeSerial(0, 0, 1), por ejemplo.

A ver si alguien me puede arrojar algo de luz.

Muchas gracias.

Featured Replies

No hay posts para mostrar

Archivado

Este tema está ahora archivado y está cerrado a más respuestas.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.