Fill set columns to pdf

55 views Asked by At

I am exporting a .xlsm sheet to PDF using Visual Basic (VBA). I only want to export the columns A:Z.

I have tried this:

    Dim ws As Worksheet
    For Each ws In ActiveWorkbook.Worksheets
        With ws.PageSetup
            .PrintArea = "$A:$Z"
            .Zoom = False
            .FitToPagesWide = 1
            .FitToPagesTall = False
            .Orientation = xlLandscape
            .PaperSize = xlPaperA3
            .RightMargin = Application.InchesToPoints(0.25)
        End With
    Next
    ThisWorkbook.Sheets("Diagram").Select
        ActiveSheet.ExportAsFixedFormat _
        Type:=xlTypePDF, _
        Filename:=strFilename, _
        Quality:=xlQualityStandard, _
        IncludeDocProperties:=True, _
        IgnorePrintAreas:=True, _
        OpenAfterPublish:=False

But I get space on the right side like it has filled the whole page just hid the columns I didn't select...

Is it any way to fix this problem and make column A:Z fill the whole page?

Any help is greatly appreciated :)

0

There are 0 answers