Tengo una código en visual basic, con este ingreso a una página de búsqueda pero necesito guardar la página completa como PDF, y hacer esto con todos los datos de la columna A.
Este es mi código
'Option Explicit
Sub ExtraerDatos()
Dim IE As Object
Dim c As Long, UltimaFila As Long
Dim Celda As Range
Application.ScreenUpdating = False
Set IE = CreateObject("InternetExplorer.Application")
Let UltimaFila = Cells(Rows.Count, 1).End(xlUp).Row
IE.navigate "http://192.168.1.76/frmPrincipal.aspx"
IE.Visible = True
For Each Celda In Range("A2:A" & UltimaFila)
Application.Wait (Now + TimeValue("0:00:05"))
With IE
.Document.getElementById("txtDato").Value = Celda.Value
.Document.getElementById("btnCon").Click
**Aqui necesito que guarde la pagina web**
Do Until IE.readyState = 4
DoEvents
Loop
Application.Wait (Now + TimeValue("0:00:05"))
End With
Next Celda
IE.Quit
Set IE = Nothing
Application.ScreenUpdating = True
MsgBox "Proceso finalizado"
End Sub'
avance hasta aquí mi código, he conseguido que se abra la ventana para escribir el nombre, pero no puedo hacer que el nombre del archivo sea el mismo de la celda ni tampoco darle clic en guardar.
Option Explicit
Sub ExtraerDatos()
Dim IE As Object
Dim c As Long, UltimaFila As Long
Dim elementsTable As Object, elementsTableDiv As Object
Dim Celda As Range
Const OLECMDID_PRINT = 6
Const OLECMDEXECOPT_DONTPROMPTUSER = 2
Const PRINT_WAITFORCOMPLETION = 2
Application.ScreenUpdating = False
Set IE = CreateObject("InternetExplorer.Application")
Let UltimaFila = Cells(Rows.Count, 1).End(xlUp).Row
IE.navigate "http://192.168.1.76/frmPrincipal.aspx"
IE.Visible = True
For Each Celda In Range("A2:A" & UltimaFila)
Application.Wait (Now + TimeValue("0:00:03"))
With IE
.Document.getElementById("txtDato").Value = Celda.Value
.Document.getElementById("btnCon").Click
.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER
End With
Next Celda
IE.Quit
Set IE = Nothing
Application.ScreenUpdating = True
MsgBox "Proceso finalizado"
End Sub