Sub CreaPDF() Dim Pregunta As Integer Dim NombreArchivo, RutaArchivo As String Pregunta = MsgBox("¿Estás seguro de generar recibo en PDF?", vbOKCancel, "Excel Consultor") If Pregunta = 2 Then Exit Sub NombreArchivo = Range("a1").Value RutaArchivo = ActiveWorkbook.Path & "\" & NombreArchivo & ".pdf" ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=RutaArchivo, _ Quality:=xlQualityStandard, IncludeDocProperties:=True, _ IgnorePrintAreas:=False, OpenAfterPublish:=False Range("a1").Select MsgBox "El archivo " & NombreArchivo & " se creó satisfactoriamente", vbOKOnly + vbInformation, "Excel Consultor" End Sub
Descarga Archivo de Ejemplo