"Hello, I need to convert a quotation currently in PowerPoint to an Excel format. The goal is to generate a PDF from Excel that matches the full-page, margin-free layout of our current PowerPoint PDFs. Despite trying various settings like 'fit to page' and setting margins to zero, I haven't been able to achieve this. Can you help me replicate this behavior in Excel?"
My full slides are always in A1:M25 on all my sheets.
The code bellow doesn't work. I still have white margins.
Sub PrintRangeToPDF()
Dim ws As Worksheet
Set ws = ThisWorkbook.Worksheets("Sheet1")
' Set the print area
ws.PageSetup.PrintArea = "A1:O22"
' Adjust page setup
With ws.PageSetup
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 1
.LeftMargin = 0
.RightMargin = 0
.TopMargin = 0
.BottomMargin = 0
.HeaderMargin = 0
.FooterMargin = 0
.Orientation = xlLandscape
.PaperSize = xlPaperA4
End With
' Export to PDF
ws.ExportAsFixedFormat Type:=xlTypePDF, Filename:=ThisWorkbook.Path & "\ExportedPDF_Dynamic.pdf"
End Sub
My full slides are always in A1:M25 on all my sheets.
The code bellow doesn't work. I still have white margins.
Sub PrintRangeToPDF()
Dim ws As Worksheet
Set ws = ThisWorkbook.Worksheets("Sheet1")
' Set the print area
ws.PageSetup.PrintArea = "A1:O22"
' Adjust page setup
With ws.PageSetup
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 1
.LeftMargin = 0
.RightMargin = 0
.TopMargin = 0
.BottomMargin = 0
.HeaderMargin = 0
.FooterMargin = 0
.Orientation = xlLandscape
.PaperSize = xlPaperA4
End With
' Export to PDF
ws.ExportAsFixedFormat Type:=xlTypePDF, Filename:=ThisWorkbook.Path & "\ExportedPDF_Dynamic.pdf"
End Sub