I have a macro to export and save the table to a PDF.
However, it is only exporting the data rows. The pdf doesn't show the header row and total row.
When I run the code, it does select the whole table including the header and total row, but it isn't printing out those rows in the PDF. Any ideas as to why?
However, it is only exporting the data rows. The pdf doesn't show the header row and total row.
Code:
Sub PrintMileage()
Dim ws As Worksheet
Set ws = ActiveSheet
Dim tbl As ListObject
Set tbl = ws.ListObjects(1)
tbl.Range.Select
ActiveSheet.PageSetup.PrintArea = tbl
Dim FName As Variant
FName = Application.GetSaveAsFilename( _
FileFilter:="PDF files, *.pdf", _
Title:="Export to pdf")
If FName <> False Then
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=FName _
, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=True
End If
End Sub
When I run the code, it does select the whole table including the header and total row, but it isn't printing out those rows in the PDF. Any ideas as to why?