• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Printing to pdf and resizing

Punner77

New Member
Hi, I don't use vba too often, so I am not well versed in it. I am trying to take a range area and print it to a pdf. While the below macro does work, it sometimes makes the image way too large (spanning multiple sheets), or way too small. I don' t know why it is inconsistent. Any help would be great!

>>> use code - tags <<<
Code:
Sub PrintPDF()

Dim saveLocation As String
Dim MyDate As String
Dim Report As String
Dim rng As Range
Dim FileName As String


saveLocation = "C:\users\public\"
MyDate = Format(Date, "YYYY-MM-DD")
Report = Sheets("InputSheet").Range("B3")

    Set rng = Sheets("Sheet3").Range("A1:Z24")


        ThisWorkbook.Sheets("Sheet3").PageSetup. _
                    RightFooter = "Created by Sybrandy"
                    Zoom = 100
                    Orientation = xlLandscape
                    FitToPagesWide = 1
                    FitToPagesTall = False


        rng.ExportAsFixedFormat Type:=xlTypePDF, _
        FileName:=saveLocation & MyDate & "_" & Report, _
        Quality:=xlQualityStandard, _
        IncludeDocProperties:=True, _
        IgnorePrintAreas:=False, _
        OpenAfterPublish:=True


End Sub
 
Last edited by a moderator:
Back
Top