I have a table called Overview which has a column that represents sheet names I wish to export as a single PDF. the msgbox returns printarray as the correct text. if I type the text in manually to the 'Sheets(Array(Printarray)).Select' line it will return a single PDF.
but form then on I am stuck.... please help..
Sub ExportAsPDF()
Dim FolderPath As String
FolderPath = ActiveWorkbook.Path
Dim tbl As ListObject
Set tbl = Sheets("Overview").ListObjects("Overview")
DStot = tbl.DataBodyRange.Rows.Count
For DS = 2 To DStot + 1 Step 1
If DS = DStot + 1 Then
Printarray = Printarray & Chr(34) & Sheets("Overview").Range("A" & DS).Value & Chr(34)
ElseIf DS = 2 Then
Printarray = Chr(34) & Sheets("Overview").Range("A" & DS).Value & Chr(34) & ","
Else
Printarray = Printarray & Chr(34) & Sheets("Overview").Range("A" & DS).Value & Chr(34) & ","
End If
Next DS
msgbox(Printarray)
Sheets(Array(Printarray)).Select
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=FolderPath & "\Sales", _
openafterpublish:=True, ignoreprintareas:=False
Sheets("config").Select
End Sub