Borderless Print to PDF
I want to export an excel sheet to a PDF. I do so with the following VBA code (the comments are just some things I tried):
ThisWorkbook.Sheets(sheet).Select
‘ActiveSheet.PageSetup.PrintArea = “A1:A320”
With ActiveSheet.PageSetup
‘.Zoom = False
‘.FitToPagesTall = 1
‘.FitToPagesWide = 1
‘.LeftMargin = Application.InchesToPoints(0)
‘.RightMargin = Application.InchesToPoints(0)
‘.TopMargin = Application.InchesToPoints(0)
‘.BottomMargin = Application.InchesToPoints(0)
End With
Application.ActivePrinter = “Microsoft Print to PDF on Ne00:”
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=filepath & “_noFont.pdf”, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
My problem is that the pdf has a border at the bottom and on the left side regardeless of my margin-settings.
Thanks in advance and let me know if you need more information.
System details:
Excel 2019 Version 2312 (Build 17126.20132) 64-bit
I’ve tried:
Set Custom Margins to 0Use Microsoft Print to PDF as Printer: Application.ActivePrinter = “Microsoft Print to PDF on Ne00:”Specifically define PrintArea: ActiveSheet.PageSetup.PrintArea = “A1:A64″Define Scaling as fot to: 1 page wide by 1 page tall: .FitToPagesTall = 1 .FitToPagesWide = 1Disable “Scale Content for A4 paper sizes” (OptionsAdvancedGeneral)Check default paper size: A4 with limits set to 0,00 cm
I want to export an excel sheet to a PDF. I do so with the following VBA code (the comments are just some things I tried):ThisWorkbook.Sheets(sheet).Select
‘ActiveSheet.PageSetup.PrintArea = “A1:A320”
With ActiveSheet.PageSetup
‘.Zoom = False
‘.FitToPagesTall = 1
‘.FitToPagesWide = 1
‘.LeftMargin = Application.InchesToPoints(0)
‘.RightMargin = Application.InchesToPoints(0)
‘.TopMargin = Application.InchesToPoints(0)
‘.BottomMargin = Application.InchesToPoints(0)
End With
Application.ActivePrinter = “Microsoft Print to PDF on Ne00:”
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=filepath & “_noFont.pdf”, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=FalseMy problem is that the pdf has a border at the bottom and on the left side regardeless of my margin-settings.Printed as PDF Thanks in advance and let me know if you need more information. System details:Excel 2019 Version 2312 (Build 17126.20132) 64-bitI’ve tried:Set Custom Margins to 0Use Microsoft Print to PDF as Printer: Application.ActivePrinter = “Microsoft Print to PDF on Ne00:”Specifically define PrintArea: ActiveSheet.PageSetup.PrintArea = “A1:A64″Define Scaling as fot to: 1 page wide by 1 page tall: .FitToPagesTall = 1 .FitToPagesWide = 1Disable “Scale Content for A4 paper sizes” (OptionsAdvancedGeneral)Check default paper size: A4 with limits set to 0,00 cm Read More