+ Reply to Thread
Results 1 to 4 of 4

Export PDF leaves undesirable blank space

  1. #1
    Registered User
    Join Date
    06-08-2019
    Location
    BC Canada
    MS-Off Ver
    2013
    Posts
    8

    Export PDF leaves undesirable blank space

    Hello, and thanks for any advice you might have for me.

    I have code within an Excel file designed to save a range to PDF that we then link into our CAD files. It is nearly working perfectly except the PDF output runs past the range with extra white space below on to a second, blank page. I've tried setting the print area and turning off "ignore print area" but I don't see any effect. What I'd really like to see is the PDF output cropped to the actual range with little to no margins.

    Code:

    Sub SaveCodeSummaryAsPDF()
    Dim exportRng As Range
    Dim pdfile As String
    'Setting range to be printed
    Set exportRng = Range("A1:D44")
    pdfile = "loadcalc.pdf"
    pdfile = ThisWorkbook.Path & "\" & pdfile
    exportRng.ExportAsFixedFormat Type:=xlTypePDF, _
    Filename:=pdfile, _
    Quality:=xlQualityStandard, _
    IncludeDocProperties:=True, _
    IgnorePrintAreas:=False, _ ' I have tried both settings here
    OpenAfterPublish:=True
    End Sub

  2. #2
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,528

    Re: Export PDF leaves undesirable blank space

    What is the result of this?
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    06-08-2019
    Location
    BC Canada
    MS-Off Ver
    2013
    Posts
    8

    Re: Export PDF leaves undesirable blank space

    Thank you.
    The problem turned out to be the width. My range included column D but that is an empty and wide column. With a range A-C it seems to behave now.
    Last edited by Brian Muir; 11-08-2020 at 11:48 AM.

  4. #4
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,528

    Re: Export PDF leaves undesirable blank space

    Good to hear you got it sorted.
    Good luck.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 1
    Last Post: 04-18-2017, 10:19 PM
  2. Replies: 1
    Last Post: 07-31-2014, 01:43 AM
  3. [SOLVED] Copy to next available row leaves blank row
    By vonrainer in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-27-2014, 08:20 AM
  4. [SOLVED] If statement that copies text from a separate worksheet, or if blank, leaves cell blank.
    By barleycorn in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-22-2012, 12:30 PM
  5. Substitue Leaves Excessive Space, Cannot Use TRIM
    By goss in forum Excel General
    Replies: 4
    Last Post: 05-22-2012, 02:06 PM
  6. Replies: 4
    Last Post: 07-17-2006, 03:55 PM
  7. [SOLVED] Hiding Rows Leaves Labels Blank
    By Laura in forum Excel General
    Replies: 3
    Last Post: 03-24-2006, 09:15 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1