Hello all,
I`m not very good in VBA and i face an issue and i don`t know what can i do to resolve it.
I created a ListBox which contain some sheets name from my workbook. I have multiple selection activated. I want to be able to export this sheets to pdf.
If i use print preview or print out it shows me or printing all, like i want and is working great but if i want to export to PDF is not working. Do you have an idea what i miss or can you give me an idea how can i resolve this ?
Thank you all !
I`m not very good in VBA and i face an issue and i don`t know what can i do to resolve it.
I created a ListBox which contain some sheets name from my workbook. I have multiple selection activated. I want to be able to export this sheets to pdf.
If i use print preview or print out it shows me or printing all, like i want and is working great but if i want to export to PDF is not working. Do you have an idea what i miss or can you give me an idea how can i resolve this ?
VBA Code:
Sub Print_Sheets()
Dim i As Long, c As Long
Dim SheetArray() As String
With ActiveSheet.ListBox1
For i = 0 To .ListCount - 1
If .Selected(i) Then
ReDim Preserve SheetArray(c)
SheetArray(c) = .List(i)
c = c + 1
End If
Next i
Sheets(SheetArray()).ExportAsFixedFormat Type:=xlTypePDF, Filename:="C:\Users\user\Desktop\xyz", Quality:=xlQualityStandard, OpenAfterPublish:=True
'Sheets(SheetArray()).PrintOut
'Sheets(SheetArray()).PrintPreview
End With
End Sub
Thank you all !