+ Reply to Thread
Results 1 to 2 of 2

How to split multiple excel data /sheets into multiple PDF files

Hybrid View

  1. #1
    Valued Forum Contributor
    Join Date
    03-28-2014
    Location
    Kuala Lumpur, Malaysia
    MS-Off Ver
    Excel 2016
    Posts
    702

    How to split multiple excel data /sheets into multiple PDF files

    Hi,

    can anyone help me?

    this code will only create multiple PDF pages but saved it into one PDF files

    I want every pages of PDF files to be split out in multiple PDF Files.


    Sub CompileReport2()
        Dim mySheets As Variant
        Dim sh As Worksheet
    
        mySheets = Array("Sheet1", "Sheet2", "Sheet3")
        For Each sh In mySheets
            Sheets(sh).PageSetup.Orientation = xlLandscape
        Next
    
        Sheets(mySheets).Select
        ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=ThisWorkbook.Path & "\" & "Test2" & ".pdf", _
            Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False
    End Sub

  2. #2
    Forum Expert Tinbendr's Avatar
    Join Date
    06-26-2012
    Location
    USA
    MS-Off Ver
    Office 2010
    Posts
    2,138

    Re: How to split multiple excel data /sheets into multiple PDF files

    Sub CompileReport2()
        Dim Sh As Worksheet
        Dim Cnt As Long
        
        For Each Sh In Worksheets
            Select Case Sh.Name
            Case "Sheet1", "Sheet2", "Sheet3"
                Cnt = Cnt + 1
                Sh.PageSetup.Orientation = xlLandscape
                Sh.ExportAsFixedFormat Type:=xlTypePDF, Filename:=ThisWorkbook.Path & "\" & "Test" & Cnt & ".pdf", _
                Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False
            End Select
        Next
    End Sub
    Here's an article about saving worksheets into workbooks.
    David
    (*) Reputation points appreciated.

+ 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] Split excel data into multiple sheets based on Employee ID
    By Preeti1309 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 04-21-2014, 02:33 AM
  2. Replies: 0
    Last Post: 11-27-2012, 01:43 PM
  3. [SOLVED] Data consolidation from Multiple CSV files and then Split data into number of files
    By neeraj_logani in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 09-18-2012, 03:59 AM
  4. Split data from one excel spreadsheet and export to multiple text files
    By jmsavage in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-03-2012, 05:30 AM
  5. Replies: 3
    Last Post: 08-02-2006, 12:35 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