+ Reply to Thread
Results 1 to 8 of 8

VBA to Print all Visable sheets - All to 1 PDF file - Colated

Hybrid View

  1. #1
    Registered User
    Join Date
    07-02-2016
    Location
    Vernon BC
    MS-Off Ver
    2013
    Posts
    17

    VBA to Print all Visable sheets - All to 1 PDF file - Colated

    I have tried searching but have come up with only partials of what I might need

    I have a excel 2013 file that has 25 pages with some being charts and some being report info

    There will be multiple users with different PDF programs, and the user will need to just save to a folder.

    There are hidden sheets, so to keep things simple I would like to PDF all visible sheets to 1 file ?

    I would appreciate any Help ! even direction to a link I may have missed !

    Thanks in Advance, Gerry..
    Last edited by Gerry Pasveer; 07-23-2016 at 03:08 PM.

  2. #2
    Forum Contributor
    Join Date
    07-11-2012
    Location
    india
    MS-Off Ver
    Excel 2010
    Posts
    144

    Re: VBA to Print all Visable sheets - All to 1 PDF file - Colated

    Hi Gerry Pasveer,

    check the code below

    Sub PrintPDF()
        Dim myArray() As Variant
        Dim i As Integer
        Dim j As Integer
        j = 0
        For i = 1 To Sheets.Count
            If Sheets(i).Visible = True Then
                ReDim Preserve myArray(j)
                myArray(j) = i
                j = j + 1
            End If
        Next i
        Sheets(myArray).Select
        
        ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:="C:\tempo.pdf", Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=True
    End Sub
    Ravikumar,

    * Please Add Reputation if solved.

  3. #3
    Registered User
    Join Date
    07-02-2016
    Location
    Vernon BC
    MS-Off Ver
    2013
    Posts
    17

    Re: VBA to Print all Visable sheets - All to 1 PDF file - Colated

    Thanks fshbet for the response however there is an issue im not sure what it could be

    I get this response

    Capture 1.JPG

    Capture2.JPG

    Thanks for your help in advance

  4. #4
    Registered User
    Join Date
    07-02-2016
    Location
    Vernon BC
    MS-Off Ver
    2013
    Posts
    17

    Re: VBA to Print all Visable sheets - All to 1 PDF file - Colated

    If the user is prompted to save to a folder, that is ok too !

  5. #5
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: VBA to Print all Visable sheets - All to 1 PDF file - Colated

    Try changing the path
    ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=ThisWorkbook.Path & "\tempo.pdf", Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=True
    < ----- Please click the little star * next to add reputation if my post helps you
    Visit Forum : From Here

  6. #6
    Registered User
    Join Date
    07-02-2016
    Location
    Vernon BC
    MS-Off Ver
    2013
    Posts
    17

    Re: VBA to Print all Visable sheets - All to 1 PDF file - Colated

    Thank you very much fshbet and Yasser Khalil this is working great !!

    Have a great day !

  7. #7
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: VBA to Print all Visable sheets - All to 1 PDF file - Colated

    You're welcome Gerry. Glad we can offer some help for you and thanks a lot for fshbet for the great solution

  8. #8
    Forum Contributor
    Join Date
    07-11-2012
    Location
    india
    MS-Off Ver
    Excel 2010
    Posts
    144

    Re: VBA to Print all Visable sheets - All to 1 PDF file - Colated

    welcome friends.

+ 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] Print sheets based on a cell value to a merged pdf file
    By ccsmith in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-19-2014, 10:10 AM
  2. [SOLVED] Print 2 Excel sheets to same PDF File
    By groundin in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-18-2014, 02:11 PM
  3. Print 2 sheets to one PDF file
    By akderitend in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-24-2014, 08:31 AM
  4. Sheets hidden or visable based on yes/no answer
    By nickbg in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-16-2012, 02:53 AM
  5. [SOLVED] Schedule Excel to open file, print sheets, close file
    By tonychopra194 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-22-2012, 05:15 AM
  6. Print sheets to PDF when file opened?
    By Wabby in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-15-2010, 05:21 AM
  7. Replies: 2
    Last Post: 04-07-2005, 09:06 AM

Tags for this Thread

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