Macro que permita generar archivo único en PDF
Publicado por JOSE LUIS (60 intervenciones) el 26/08/2020 19:46:02
Buenos días a los integrantes de este foro, en esta ocasión recurro a uds, para que brinde su apoyo con esta macro y lo que básicamente es generar un archivo en PDF en forma individua de acuerdo a la imagen con el nombre PDF y lo que se pretender es generar un solo archivo PDF, desde ya agradezco la atención por su gentil apoyo.
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
Option Explicit
Sub ElegirAccion()
Dim i As Integer
Dim intInicial As Integer
Dim intFinal As Integer
Dim intConsecutivo As Integer
Dim srtTitulo As String
Dim Ruta As String
Dim nombre As String
Dim pass As String, hoja As String
Application.ScreenUpdating = False
Sheets("BOLETA PDF").Activate
hoja = "BOLETA PDF"
pass = "A"
ActiveSheet.Unprotect pass
nombre = ThisWorkbook.Sheets("BOLETA PDF").Range("O4").Value
srtTitulo = "PRUEBITA"
intConsecutivo = ThisWorkbook.Sheets("BOLETA PDF").Range("CONSECUTIVO").Value
intInicial = Sheets("BOLETA PDF").Range("N4")
intFinal = Sheets("BOLETA PDF").Range("M3")
If intFinal < intInicial Or intFinal > intConsecutivo Then
MsgBox "Valida el ID final.", vbExclamation, srtTitulo
Else
Sheets("BOLETA PDF").Select
Ruta = ActiveWorkbook.Path & "\BOLETAS"
For i = intInicial To intFinal
ThisWorkbook.Sheets("BOLETA PDF").Range("L4").Value = i
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=Ruta & "\" & Sheets("BOLETA PDF").Range("B6") & " " & "BOLETAS MN " & Sheets("BOLETA PDF").Range("H7") & ".pdf", _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
Next i
End If
ActiveSheet.Protect pass
Sheets("MENU").Activate
Range("B8").Select
intInicial = Sheets("BOLETA PDF").Range("N4")
Application.ScreenUpdating = True
End Sub
Valora esta pregunta
0