Va, genera un archivo pdf y xlsx con las hojas seleccionadas.
Private Sub CommandButton1_Click()
'Por.Dante Amor
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Dim hojas()
n = -1
For i = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(i) Then
'h = ListBox1.List(i)
'Sheets(h).PrintOut Copies:=1, Collate:=True
n = n + 1
ReDim Preserve hojas(n)
hojas(n) = ListBox1.List(i)
End If
Next
If n > -1 Then
ruta = ThisWorkbook.Path & "\"
arch = "Hojas"
Sheets(hojas).Copy
ActiveWorkbook.ExportAsFixedFormat Type:=xlTypePDF, _
Filename:=ruta & arch & ".pdf", _
Quality:=xlQualityStandard, IncludeDocProperties:=True, _
IgnorePrintAreas:=False, OpenAfterPublish:=False
ActiveWorkbook.SaveAs _
Filename:=ruta & arch & ".xlsx", _
FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
ActiveWorkbook.Close False
MsgBox "Archivos XLSX y PDF guardado"
End If
End Sub
'
Private Sub UserForm_Activate()
'Por.Dante Amor
ListBox1.MultiSelect = 1
ListBox1.ListStyle = 1
For Each h In Sheets
ListBox1.AddItem h.Name
Next
End Sub
.
.