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.

¿Cómo poner el nombre deseado al archivo?

publicado

Tengo un código VBA 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).

 

Cita

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

 

 

Featured Replies

publicado

Hola, te dejo la respuesta que te di en otro foro. Obvio es la idea, ajústalo a tu necesidad:

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

Application.Wait (Now + TimeValue("0:00:05"))
SendKeys Celda.Value, True
SendKeys "{TAB}"
SendKeys "~"

Application.Wait (Now + TimeValue("0:00:05"))

Next Celda

IE.Quit

Set IE = Nothing
Application.ScreenUpdating = True
MsgBox "Proceso finalizado"

End Sub

Saludos

Abraham Valencia

 

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.