+ Reply to Thread
Results 1 to 4 of 4

Excel VBA printing a PDF (not Print To PDF)

  1. #1
    Registered User
    Join Date
    01-08-2020
    Location
    Worcester, England
    MS-Off Ver
    2016
    Posts
    35

    Excel VBA printing a PDF (not Print To PDF)

    Good afternoon,

    I am trying to automate part of a work process where the spreadsheet in use will print a PDF document to the users default printer. I have been researching how to do this and I am of the understanding that it is either very difficult or not possible to select two sheets and print them back to back within excel, so I have gone down the route of creating the two sheets as one PDF document. I am trying to understand how to print off the PDF within the same code, as this is planned to work via a Macro Button.

    I've included my current code below, I would appreciate any advise or insight that can be offered.

    Please Login or Register  to view this content.
    Last edited by Pezzaa; 03-30-2021 at 09:27 AM.

  2. #2
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    6,986

    Re: Excel VBA printing a PDF (not Print To PDF)

    .
    You can print multiple pages in Excel.

    Please Login or Register  to view this content.
    The above tells Excel you want to print more than one sheet in the active workbook. When followed with a FROM and TO sheet numbers :

    Please Login or Register  to view this content.
    It will print sheets 1 to 3.

    (Resource : https://docs.microsoft.com/en-us/off...kbook.printout

    *********************************************************

    If you desire to print several non-consecutive sheets you can do so using an array of sheets :

    Resource: http://dailydoseofexcel.com/archives...ltiple-sheets/

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    01-08-2020
    Location
    Worcester, England
    MS-Off Ver
    2016
    Posts
    35

    Re: Excel VBA printing a PDF (not Print To PDF)

    Hi Logit,

    Thank you for the code! It works as expected and I am now able to omit the Save to PDF section.

    Does the code you've provided allow us to expand on the printing requirements, such as printing back to back and in colour?

  4. #4
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    6,986

    Re: Excel VBA printing a PDF (not Print To PDF)

    .
    You can Google "VBA Print Back To Back" ... also "VBA Print Color"

    I did a quick look at the print both sides and there seems to be controversy whether it is possible in VBA ... although there are code samples out there
    where the author claims success. You'll just have to experiment with their suggested codes.

+ 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. EXCEL VBA - Print PDF - removes the active filter before printing
    By umeshbanga in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-23-2015, 03:19 AM
  2. Replies: 1
    Last Post: 06-11-2014, 09:23 AM
  3. printing excel to expand to print the entire page
    By jesber8 in forum Excel General
    Replies: 3
    Last Post: 06-08-2014, 01:58 AM
  4. Excel 2007 - Partial Printing of a print area
    By Terry G in forum Excel General
    Replies: 0
    Last Post: 04-19-2012, 11:10 AM
  5. Replies: 5
    Last Post: 09-28-2011, 03:21 PM
  6. Replies: 4
    Last Post: 02-17-2006, 08:36 AM
  7. Why is my printing garbled? Unable to print only in Excel.
    By Janie777 in forum Excel - New Users/Basics
    Replies: 0
    Last Post: 08-18-2005, 12:05 PM

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