¿Cómo poner el nombre deseado al archivo?
Publicado por Milton (1 intervención) el 26/07/2019 18:53:58
Tengo un código que abre una web y hace búsquedas y abre la ventana de guardar la web como PDF no tengo idea como hacer que el nombre del archivo a guardar sea el mismo que el usado para búsqueda (uso los datos de la columna A). Adjunto imagen hasta donde he llegado con el código.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Option Explicit
Sub ExtraerDatos()
Dim IE 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
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

Valora esta pregunta


0