VBA Print Changing Paper Size On Bluebeam

FRIJOE

New Member
Joined
May 4, 2017
Messages
19
I wrote a print to pdf macro that prints this excel template I'm working on. I want it to print 11x17 however when I run the macro bluebeam is recognizing the excel printout sheet size as A1 (594 x 841mm). This may be perhaps because I have the margins so small, however given the following constraints within the code, it is printing exactly how I want it to.

As of now, I have to manually select the paper size when I attempt to print a hard copy from blue beam but the problem I am running into is when I attempt to apply a header and footer in bluebeam to the print out from excel. Other sheets (from either autocad or solidworks) that are printed 11x17 are recognized as 11x17 so when I attempt to apply a header and footer (lets say .35 inches from the bottom and .35 inches from the right) for the sheet's numbering nomenclature, it appears where I want it for the normal 11x17 sheets. However; the excel print outs appear way low and right.

Is there any way to force excel to print to exactly 11x17 so bluebeam does not resize the sheet to A1 (594 x 841 mm)?

Any help is appreciated.
Thank you.

Code:
Sub toPDF()
    thepath = CStr(Range("AQ13").Value)
    thename = CStr(Range("AQ16").Value)
    newrando = Int((50 - 1 + 1) * Rnd + 1)
    On Error GoTo Handled
    
    If Len(Dir(thepath & "\printouts", vbDirectory)) = 0 Then
        MkDir thepath & "\printouts"
    End If

    With ActiveSheet.PageSetup
        .PaperSize = xlPaperTabloid
        .PrintArea = "$A$1:$AO$67"
        .LeftMargin = _
            Application.InchesToPoints(0.25)
        .RightMargin = _
            Application.InchesToPoints(0#)
        .HeaderMargin = _
            Application.InchesToPoints(0.25)
        .FooterMargin = _
            Application.InchesToPoints(0.2)
        .TopMargin = _
            Application.InchesToPoints(0.25)
        .BottomMargin = _
            Application.InchesToPoints(0#)
        .PrintQuality = 96
        .Zoom = False
        .FitToPagesWide = 1
        .FitToPagesTall = 1
    End With
    
    If ActiveSheet.PageSetup.Orientation = xlPortrait Then
        ActiveSheet.PageSetup.Orientation = xlLandscape
        Else
        ActiveSheet.PageSetup.Orientation = xlLandscape
    End If
        
    
    FileNam = thepath & "\printouts\" & "Lift Data Sheet" & " - " & thename & ".pdf"
    ActiveSheet.ExportAsFixedFormat Filename:=FileNam, Type:=xlTypePDF, OpenAfterPublish:=True
    
    Exit Sub
Handled:
    FileNam = thepath & "\printouts\" & "Lift Data Sheet" & " - " & thename & newrando & ".pdf"
    ActiveSheet.ExportAsFixedFormat Filename:=FileNam, Type:=xlTypePDF, OpenAfterPublish:=True


End Sub
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.

Forum statistics

Threads
1,223,103
Messages
6,170,123
Members
452,303
Latest member
c4cstore

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top