MANIPULAR VENTANAS EMERGENTES

Miltoner77

New Member
Joined
Dec 18, 2019
Messages
3
Office Version
  1. 2016
Platform
  1. Windows
  2. Web
Hola, agradezco su ayuda, tengo un código creado, que funciona correctamente, el código abre la web, y un formulario, el inconveniente es que debo dar clic en un enlace para ver el resultado, hasta que todo esté bien, el resultado se muestra en una ventana emergente, y necesito guardar esta ventana con archivo pdf, cosa que no conseguimos.

[CÓDIGO = vba] Opción explícita

Sub ExtraerDatos ()
Dim Ie como objeto
Dim MiCombo como objeto
Dim c As Long, UltimaFila As Long
Dim Celda As Range

Const OLECMDID_PRINT = 6
Const OLECMDEXECOPT_DONTPROMPTUSER = 2
Const PRINT_WAITFORCOMPLETION = 2

Establecer Ie = CreateObject ("InternetExplorer.Application")
Deje UltimaFila = Celdas (Rows.Count, 1) .End (xlUp) .Row
Es decir, visible = verdadero
Es decir, Navigate2 "RedInServ"

Hacer mientras Ie.readyState <> READYSTATE_COMPLETE
DoEvents
Lazo
Para cada Celda In Range ("A2: A" y UltimaFila)

Con Ie
Establecer MiCombo = Ie.document.all ("ltTipo")
MiCombo.selectedIndex = 2
.document.all ("ltTipo") = "Cédula"
Application.Wait (ahora + TimeValue ("0:00:01"))
.document.all ("ltNombres"). Value = Celda.Value
Application.Wait (ahora + TimeValue ("0:00:01"))
.document.all ("enviar"). Haga clic en
Application.Wait (ahora + TimeValue ("00:00:01"))
.document.getElementsByClassName ("cont") (0) .Haga clic
Application.Wait (ahora + TimeValue ("00:00:02"))
'despues de esto se muestra mi ventana emergente intente hacerlo con sendkeys pero tampo funciona.
Terminar con

Application.Wait (ahora + TimeValue ("00:00:03"))
SendKeys "^ p"
Application.Wait (ahora + TimeValue ("00:00:03"))
SendKeys "{ENTER}"
Application.Wait (ahora + TimeValue ("00:00:01"))
SendKeys Celda.Value
Application.Wait (ahora + TimeValue ("00:00:01"))
SendKeys "~"
Application.Wait (ahora + TimeValue ("00:00:08"))
Celda siguiente

Es decir, traje

MsgBox "Proceso finalizado"
End Sub [/ CODE]
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Hi, welcome to the board! (Hola, bienvenido al foro!)

Apparently your window translator also translated the VBA code, you could paste the code again, but check that it does not translate automatically.
That way someone can help you.

(Al parecer tu traductor de ventana también tradujo el código de VBA, podrías pegar nuevamente el código, pero revisa que no se traduzca en automático.
De esa forma alguien podrá ayudarte.
)
 
Upvote 0
VBA Code:
Option Explicit

Sub ExtraerDatos()
Dim Ie As Object
Dim MiCombo As Object
Dim c As Long, UltimaFila As Long
Dim Celda As Range

Const OLECMDID_PRINT = 6
Const OLECMDEXECOPT_DONTPROMPTUSER = 2
Const PRINT_WAITFORCOMPLETION = 2

Set Ie = CreateObject("InternetExplorer.Application")
Let UltimaFila = Cells(Rows.Count, 1).End(xlUp).Row
Ie.Visible = True
Ie.Navigate2 "http://srv.redinservsa.com/busquedaClienteGeneral.php"

Do While Ie.readyState <> READYSTATE_COMPLETE
    DoEvents
Loop
For Each Celda In Range("A2:A" & UltimaFila)

With Ie
Set MiCombo = Ie.document.all("ltTipo")
        MiCombo.selectedIndex = 2
        .document.all("ltTipo") = "Cédula"
        Application.Wait (Now + TimeValue("0:00:01"))
        .document.all("ltNombres").Value = Celda.Value
         Application.Wait (Now + TimeValue("0:00:01"))
        .document.all("enviar").Click
        Application.Wait (Now + TimeValue("00:00:01"))
        .document.getElementsByClassName("cont")(0).Click
          Application.Wait (Now + TimeValue("00:00:02"))
' despues de esto se muestra mi ventana emergente intente hacerlo con sendkeys pero tampo funciona.
End With
  
Application.Wait (Now + TimeValue("00:00:03"))
SendKeys "^p"
Application.Wait (Now + TimeValue("00:00:03"))
SendKeys "{ENTER}"
Application.Wait (Now + TimeValue("00:00:01"))
SendKeys Celda.Value
Application.Wait (Now + TimeValue("00:00:01"))
SendKeys "~"
Application.Wait (Now + TimeValue("00:00:08"))
Next Celda

Ie.Quit

MsgBox "Proceso finalizado"
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,915
Messages
6,122,217
Members
449,074
Latest member
cancansova

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top