+ Reply to Thread
Results 1 to 2 of 2

Export to PDF page sizing

  1. #1
    Registered User
    Join Date
    01-08-2014
    Location
    wigan
    MS-Off Ver
    2007
    Posts
    78

    Export to PDF page sizing

    I have the following code to export a pdf of four worksheets in a workbook:

    Please Login or Register  to view this content.
    the problem I am having is that some of the pages on the pdf are not A4, they are ridiculously large in comparison to the others. Although, when I select the tabs manually and print to PDF, everything is fine.

    Any ideas?

    thanks,
    dan.

  2. #2
    Registered User
    Join Date
    10-15-2013
    Location
    Belgium
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Export to PDF page sizing

    Hi;

    I use this code for doing the same, and it works nice;

    What it does is to follow the document printing configurations;

    I think this will do the trick;

    ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=chemin, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False


    My macro looks like this:

    Sub PDF()


    Dim sNomFichierPDF As String

    code4G = ActiveSheet.Range("C9").Value 'first part of filename
    datefn6 = Format(Date, "YYYYMMDD")

    'If Len(datefn6) = 9 Then datefn6 = "0" & datefn6
    Application.DisplayAlerts = False
    Application.ScreenUpdating = False

    chemin = ActiveWorkbook.Path & "\" & code4G & "_xxxx_" & datefn6
    ThisWorkbook.Sheets(Array("sheet1", "sheet2", "sheet3", "sheet4")).Select
    ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=chemin, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False

    ActiveWorkbook.SaveAs chemin, FileFormat:=56
    Application.DisplayAlerts = True 'IT WORKS TO DISABLE ALERT PROMPT
    Application.ScreenUpdating = True

    End Sub



    Hope this is of any use to you...

+ 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. [SOLVED] Export to a new file with page properties...
    By Aris in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-03-2014, 07:26 AM
  2. Export to excel from Web page
    By velkugan in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-28-2010, 03:51 AM
  3. [SOLVED] can i export my excel page into a word doc?
    By winfree in forum Excel General
    Replies: 1
    Last Post: 03-13-2006, 02:49 PM
  4. Export data saving page set ups
    By PiPPo in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-14-2005, 02:05 PM
  5. [SOLVED] export excel to Front Page
    By judithbear in forum Excel General
    Replies: 0
    Last Post: 03-26-2005, 08:06 PM

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