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.

Guardar Hoja de libro (Remitos) sin borrar el anterior

publicado

hola amigos, tengo un pequeño problema, con ayuda he logrado crear esta macro, que imprime y guarda en pdf, el problema esta en que si me olvido de cambiar el numero de remito me lo guarda arriba del anterior perdiendo el remito viejo. "tendria que notificarme que el numero de remito ya fue usado".

espero que me puedan ayudar, gracias!!

Dejo el codigo y el excel.

Sub Print_save()
'
' Print_save Macro
'


'
Range("D2:L56").Select
Range("L2").Activate
ActiveWindow.SmallScroll Down:=-21
Range("O35").Select
ActiveWindow.SmallScroll Down:=-15
Range("C2:L56").Select
Range("L2").Activate
Selection.PrintOut Copies:=1
Range("L3").Select
nombre = Range("L3").Value
Range("C2:L56").Select
ChDir "C:\Copias Remitos\"
Selection.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"C:\Copias Remitos\" & nombre & ".pdf", _
Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=True
End Sub




[/CODE]

Print_save.rar

Featured Replies

publicado

Buenas, gustavom.....

Después de tu línea......


nombre = Range("L3").Value
[/CODE]

Incluye esto.....

[CODE]
With Application.FileSearch
.LookIn = "C:\Copias Remitos\"
.Filename = nombre & ".pdf"
If .Execute() > 0 Then
MsgBox "Se ha detectado en la ruta un archivo denominado igual que el valor de la casilla L3"
Exit Sub
End If
End With
[/CODE]

Lo que hace es, una vez recogido el nombre, comprobar si ya existe ese archivo y en caso de estar,

te avisa con un mensaje y te manda fuera de la macro para que puedas modificar el valor de referencia.

Prueba y me cuentas,

Un saludo,

Tese

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.