MANIPULAR VENTANAS EMERGENTES

Miltoner77

New Member
Joined
Dec 18, 2019
Messages
3
Office Version
2016
Platform
Windows, 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]
 

DanteAmor

Well-known Member
Joined
Dec 3, 2018
Messages
8,805
Office Version
2007
Platform
Windows
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.
)
 

Miltoner77

New Member
Joined
Dec 18, 2019
Messages
3
Office Version
2016
Platform
Windows, Web
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
 

Forum statistics

Threads
1,081,953
Messages
5,362,364
Members
400,673
Latest member
RobBro1987

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top