+ Reply to Thread
Results 1 to 4 of 4

Print to PDF with specific FileName

  1. #1
    Forum Contributor
    Join Date
    04-22-2017
    Location
    AU
    MS-Off Ver
    Microsoft 365
    Posts
    291

    Print to PDF with specific FileName

    Hi all,

    Require a VBA solution please

    Have read several suggested examples, but not to cater for specific range and many pages.
    Trying to print selected range of cells to PDF-files - Name of File to be specific to the concatenated cells in example E1 of attached example WB.
    The Macro created in this example prints to PDF but needs name input each time.

    Tab has 40 x areas same as shaded down the page
    All are same area
    Require VBA code to:
    Select range (shaded area)
    Select which Page to Print - i.e. 1, or 2, or33, or3 40
    Print Quality 150 dpi
    Zoom 80
    Save as PDF - File name to use the concatenated cells in- e.g. E1.
    e.g. file Name: Belinda Brown - Payroll - 1234-1.pdf
    Files to be saved to C:\Reports
    Hope someone can assist please
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    04-22-2017
    Location
    AU
    MS-Off Ver
    Microsoft 365
    Posts
    291

    Re: Save to PDF with specific FileName

    Further to previous WB, some additional information and changes

    I don’t know much about BA so hope someone can assist here please.

    Attached WB Rev B is an update.

    Tab will now contains 3 lots of 30 areas (shaded ) – total of 90 sheets
    All shaded areas are same size – 1 x A4 page 80%
    All have specific Data in top – e.g. Row 4 etc – 3 x Fields
    These 3 x Fields are also used to concatenate as per Row 1 etc.

    Research located the following in the Microsoft Community Site:
    Macro to save as PDF with auto filename as cell value
    HTML Code: 
    So, have created 3 x Macros and used the code from above (thankyou Gary’s Student etc.)
    Module 1 in attached WB has code for the first 3 x sheets for testing

    The code works to a degree, but has some issues connected with the VBA Code.
    When you run the Macro (Red Box),
    Saves Heading row containing Concatenate Fields e.g. Row 1, Row 69 etc – should NOT be included
    Routine saves all 90x sheets ( page)s in one file – should only be one page for each Macro
    After Save, screen shows PDF file but always displays the first sheet.
    Other matters hoping to have solved as well are:
    Each PDF to be as small as possible
    Resolution is being saved at 600x600. Would like to save to 150 dpi
    Would like to save all files to specific location – C:\Reports
    Files can then be printed as required.
    I don’t know how to add to the Code to set the Range for each page, and present the sheet just saved.
    Attached Files Attached Files
    Last edited by VisionSmart; 06-02-2020 at 06:34 PM. Reason: Better explanation: Page formatting: edit comments

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

    Re: Print to PDF with specific FileName

    Hi VisionSmart,

    Try the following code (non-working because it requires additional resources inside the attached file) included in the modified copy of your sample workbook. Please note that it took 4-6 minutes to create 90 pdf files on my computer. Your times may differ.
    Please Login or Register  to view this content.
    Lewis

  4. #4
    Forum Contributor
    Join Date
    04-22-2017
    Location
    AU
    MS-Off Ver
    Microsoft 365
    Posts
    291

    Re: Print to PDF with specific FileName

    LJMetzger - Thank you for taking time to create this considerable solution

    I will work my way through this and see how I go.

+ 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. Need to locate specific sheet, export/save as PDF with a specific filename.
    By taylorsm in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-02-2018, 09:24 AM
  2. VBA-print as pdf w/ filename from a cell, & print in folder excel file is located
    By wpssnotoq in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-26-2017, 06:43 PM
  3. [SOLVED] PDF print and filename
    By kieranm105 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 08-08-2016, 06:49 AM
  4. ExecWB to print webpages to PDF - automate print file filename
    By Kevin_N_PA in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-13-2016, 07:42 PM
  5. Print Macro to pdf filename
    By kdankwah in forum Excel General
    Replies: 7
    Last Post: 11-22-2015, 12:38 PM
  6. auto filename for PDF print
    By chibouki in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-18-2008, 06:56 AM
  7. set print to pdf filename
    By Matto in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-09-2005, 02:06 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