Results 1 to 2 of 2

Thread: Export PDF on multiple sheets
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    New Member
    Join Date
    Jan 2019
    Posts
    1
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Export PDF on multiple sheets

    Dear members,

    my situation:
    I have multiple charts and other stuff on multiple worksheets. For example: Sheet 1: Range A1-C9, Sheet 1 Range F9:K13 and sheet 2: Range A1-F12


    What i want to do: I want to put every element on ONE side in a PDF-document.


    My problem:
    I can export in PDF and i know the "pagesetup" commands that should fit my content onto one page. But i struggle doing it for every element.

    In logical terms the could should do:

    - go to sheet 1
    - get range A1-C9
    - Fit that onto ONE page
    - go to sheet 1
    - get range F9-K13
    - Fit that onto ONE page
    - go to sheet 2
    - get range A1-F12
    - fit that onto ONE page
    - export PDF

    can someone help me "designing" single pages in one pdf-document??

    Thank you so much

  2. #2
    Board Regular Logit's Avatar
    Join Date
    Aug 2016
    Location
    United States
    Posts
    2,898
    Post Thanks / Like
    Mentioned
    39 Post(s)
    Tagged
    1 Thread(s)

    Default Re: Export PDF on multiple sheets

    .
    The following uses Sheet3 as the location to paste to. You can change the code to any sheet you desire.

    Code:
    Option Explicit
    
    
    Sub cpypstePDF()
    Sheet1.Range("A1:C9").Copy Sheet3.Range("A1")
    Sheet1.Range("F9:K13").Copy Sheet3.Range("A11")
    Sheet2.Range("A1:F2").Copy Sheet3.Range("A17")
    
    
    SveAsPDF
    End Sub
    
    
    Sub SveAsPDF()
    Dim fileSaveName As String
    Dim strTime, strFile, strPath As String
    
    
    strTime = Format(Now(), "yyyymmdd\_hhmm")
    strFile = ActiveWorkbook.Name & "_" & strTime
    strPath = "C:\Documents\"
    
    
    fileSaveName = Application.GetSaveAsFilename(InitialFileName:=strPath & strFile, _
    FileFilter:="PDF Files (*.pdf), *.pdf", _
    Title:="Select Folder and File Name to Save")
    
    
        
        Sheet3.ExportAsFixedFormat Type:=xlTypePDF, Filename:=fileSaveName, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
        
    'confirmation message with file info
    MsgBox "PDF file has been created: " & strFile
    
    
    End Sub

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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