+ Reply to Thread
Results 1 to 3 of 3

Printing multiple sheets to individual pdf files simultaneously?

Hybrid View

  1. #1
    Registered User
    Join Date
    09-17-2013
    Location
    Wichita, KS
    MS-Off Ver
    Excel 2010
    Posts
    1

    Printing multiple sheets to individual pdf files simultaneously?

    I have Excel 2010 and Adobe Reader 10.0. I have a workbook with 70 tabs that I need to print to individual pdf files named the same as the tab name. How can I do that?

  2. #2
    Forum Contributor
    Join Date
    05-08-2013
    Location
    California
    MS-Off Ver
    Excel 2013
    Posts
    102

    Re: Printing multiple sheets to individual pdf files simultaneously?

    Paste this code into a module and run it.

    Sub TabsPDF()
    
    'Declare variables
    Dim mydir As String
    Dim sh As Worksheet
    Dim oldactivesheet As Worksheet
    
    Application.ScreenUpdating = False
    
    'Store a reference to the active sheet
    Set oldactivesheet = ActiveSheet
    
    'Prompt the user for a directory to store the PDF files
    With Application.FileDialog(msoFileDialogFolderPicker)
        .InitialFileName = Application.DefaultFilePath & "\"
        .Title = "Please select a location to store your PDF files."
        .Show
        If .SelectedItems.Count = 0 Then
            MsgBox "Cancelled"
            Exit Sub
        Else
            mydir = .SelectedItems(1) & "\"
        End If
    End With
            
    
    'Loop through each tab
    For Each sh In Worksheets
        sh.Activate
        
            'Create PDF file and save to mydir
            ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
                mydir & sh.Name, Quality:=xlQualityStandard, _
                IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _
                False
    Next sh
    
    Application.ScreenUpdating = True
    
    'Reactivate the original active sheet
    oldactivesheet.Activate
    
    MsgBox "All PDF files have been created and stored in " & mydir & "."
    
    End Sub
    Hope this helps.
    _____________________________
    [1] If this reply was helpful, click the star to the left.
    [2] If this reply answered your question, mark this thread as [SOLVED].
    Last edited by Dimitrov; 09-18-2013 at 10:59 PM.

  3. #3
    Registered User
    Join Date
    04-02-2015
    Location
    UK
    MS-Off Ver
    2010
    Posts
    1

    Re: Printing multiple sheets to individual pdf files simultaneously?

    This is fantastic - worked first time - just saves them all into the directory.

    however in addition I want it to then attach each pdf into an email with some standard text in the body of the email and standard subject (but sent to different people) how would i do this please would i need a separate module of code or could it be added to this one.

    I then am trying to create a button to run this on click....?

+ 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. Edit multiple excel files simultaneously
    By Whozurdady1 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-24-2014, 09:31 AM
  2. Printing excel sheets to multiple pdf files
    By Lizzz in forum Excel General
    Replies: 1
    Last Post: 04-24-2013, 03:27 PM
  3. [SOLVED] Simultaneously add sheets to multiple workbooks
    By dorkydancer in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-09-2012, 11:31 AM
  4. Help importing multiple text files to individual sheets in an excel workbook
    By cham.miller in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-13-2010, 06:55 PM
  5. Format multiple sheets simultaneously with macro?
    By Synthia in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-14-2010, 12:44 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