+ Reply to Thread
Results 1 to 5 of 5

Advice: Print to PDF OR Print to Printer macro

  1. #1
    Registered User
    Join Date
    08-15-2016
    Location
    Melbourne, Australia
    MS-Off Ver
    Mac 2011
    Posts
    8

    Advice: Print to PDF OR Print to Printer macro

    Hi guys,

    So I need to EITHER have a macro which prints a worksheet or sends that worksheet to a PDF file. Here's the challenging parts though:
    1. Needs to work on Mac & Windows
    2. Sheet being printed is different to where the macro button will be
    3. Specific print area needs to be set (I figured out SetPrintArea)
    4. Page setup converted to Landscape
    5. 'Fit to page' set to 1 page wide by 8 pages tall
    It's those last 2 that are giving me grief. While PDF would be more elegant, the file save path issue makes it tricky for me. So I went down the printing path but it's not resizing to 1 wide by 8 tall...

    Any advice?

  2. #2
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Advice: Print to PDF OR Print to Printer macro

    Hi Brenton,

    I can't help you with the Mac part at all.

    Items 4 and 5 are difficult even with ideal conditions. To be successful, you have to understand how VBA printing differs from manual printing.

    VBA has no 'fit to page' setting. You need to set the margins including headers and footers (usually preset manually) and then have an appropriate ZOOM Percent until the output looks good. That's probably why you are having problems with the 1 x 8. It is often a tedious trial and error process.

    Pdf output is similar, but a little trickier, especially if you are not printing the entire print area. When printing, you can specify a starting an ending page number to print. Pdf requires a range. You have to convert the page numbers to a range for pdf. This is not trivial when the print area is more than one page wide for a number of reasons including, 'page numbers down then over', 'page numbers over then down', possible non-contiguous print areas.

    If you can upload a sample file containing typical 1 x 8 sheets, I may be able to provide some code for both printing and pdf files.


    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

    Lewis

  3. #3
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: Advice: Print to PDF OR Print to Printer macro

    For item 5 perhaps

    Please Login or Register  to view this content.
    Untested as I've got no printer at the moment.

    Alf

  4. #4
    Registered User
    Join Date
    08-15-2016
    Location
    Melbourne, Australia
    MS-Off Ver
    Mac 2011
    Posts
    8

    Re: Advice: Print to PDF OR Print to Printer macro

    Thank you so much, I have been away for a few days and just read this. Shall check it out now!

  5. #5
    Registered User
    Join Date
    08-15-2016
    Location
    Melbourne, Australia
    MS-Off Ver
    Mac 2011
    Posts
    8

    Re: Advice: Print to PDF OR Print to Printer macro

    Here's a sample. The 'Report Dark' tab is the screen version, while 'Report' is the print version.

    Does that make sense?
    Attached Files Attached Files

+ 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. Replies: 0
    Last Post: 05-04-2015, 03:40 AM
  2. Replies: 0
    Last Post: 01-20-2014, 07:10 PM
  3. [SOLVED] Macro to print to the default printer
    By Alves76 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 04-22-2013, 05:47 AM
  4. VBA for print if cell contains, then choose printer. Have code just need advice.
    By lukestkd in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-10-2012, 08:39 PM
  5. macro to print 2 copies to default printer, then 1 copy to Adobe PDF printer
    By jwright650 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-26-2011, 01:07 PM
  6. Macro to Print to specific printer
    By nsorden in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-15-2009, 12:20 PM
  7. macro print to default printer help
    By st24rsap in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-16-2009, 07:22 AM

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