Lee Rabbit
New Member
- Joined
- Apr 30, 2020
- Messages
- 43
- Office Version
- 2010
- Platform
- Windows
Hi, I have run into a bit of difficulty with a macro I am running that creates a print preview of selected worksheets from a ListBox. Everything works fine and does exactly what I need with regards to printing the selected worksheets.
However, I am also looking to save the selected sheets as one PDF into "C:\PDF\EMAIL" with values from 3 cells with underscore EG: A1 & "_"
This is the code up to the PrintPreview. Is there anyway of expanding on this to create the PDF file?
To anyone who can help, a big thanks in advance.
Lee
However, I am also looking to save the selected sheets as one PDF into "C:\PDF\EMAIL" with values from 3 cells with underscore EG: A1 & "_"
This is the code up to the PrintPreview. Is there anyway of expanding on this to create the PDF file?
VBA Code:
Sub print_sh()
Dim i As Long, c As Long
Dim SheetArray() As String
With ActiveSheet.ListBoxSh
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
End With
Sheets(SheetArray()).PrintPreview
End Sub
To anyone who can help, a big thanks in advance.
Lee