+ Reply to Thread
Results 1 to 12 of 12

Print PDF in one sheet

  1. #1
    Forum Contributor
    Join Date
    02-16-2011
    Location
    Maharashtra, Thane
    MS-Off Ver
    Excel 2021
    Posts
    241

    Print PDF in one sheet

    Hi,
    I have earlier posted one query and have resolved the issue. Here i need an additional help to print pdf only one sheet.
    In receipt sheet when will show in print preview will show from A1 to I32 and i need only this one page will print PDF automatically in the folder F:/Student Record/ and file name will be names cells of E6. Thanks.
    Attached Files Attached Files

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2505
    Posts
    27,270

    Re: Print PDF in one sheet

    Select A1:I32 and go to Page Setup > Print Area > Set Print Area

    Then

    Please Login or Register  to view this content.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Contributor
    Join Date
    02-16-2011
    Location
    Maharashtra, Thane
    MS-Off Ver
    Excel 2021
    Posts
    241

    Re: Print PDF in one sheet

    Hi,
    I am confusing about this code. You mean i have to do the page setup manually r you right. There is no option to select auto create pdf. Thanks.

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2505
    Posts
    27,270

    Re: Print PDF in one sheet

    Since you always want to print the same cells it is better to select the print area manually. There's no advantage to doing it in code, and if you ever need to change it you don't have to touch the code. I would only use code for that in cases where you have to determine the print areas dynamically.

    There is no option to select auto create pdf
    I do not understand what you mean by that. You are already using ExportAsFixedFormat in other parts of your code so I assume you know how to use it. If my answer is not clear please be more specific about what you need.

  5. #5
    Valued Forum Contributor
    Join Date
    05-02-2013
    Location
    Poland
    MS-Off Ver
    Excel 2013
    Posts
    368

    Re: Print PDF in one sheet

    If you want
    This is just an example
    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    02-16-2011
    Location
    Maharashtra, Thane
    MS-Off Ver
    Excel 2021
    Posts
    241

    Re: Print PDF in one sheet

    Dear Hungt Sir thank you so much. I have tried it my file and running superb.

  7. #7
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,727

    Re: Print PDF in one sheet

    Not to take away from the already suggested solutions.
    Another possibility where you do have to set the print range.
    Change references as required.

    Please Login or Register  to view this content.
    The inherent weakness of the liberal society: a too rosy view of humanity.

  8. #8
    Forum Contributor
    Join Date
    02-16-2011
    Location
    Maharashtra, Thane
    MS-Off Ver
    Excel 2021
    Posts
    241

    Re: Print PDF in one sheet

    Thanks Mr. Joli. This also works fine for me and looks nice. Confuse to use which code. Thanks again for your effort to help.

  9. #9
    Valued Forum Contributor
    Join Date
    05-02-2013
    Location
    Poland
    MS-Off Ver
    Excel 2013
    Posts
    368

    Re: Print PDF in one sheet

    Which code to use is up to you. But do you see the difference?

    Run both codes from post #5 and post #7. Don't see the difference? Check this way:

    1. Open the file from post #1 -> paste my code from post #5 -> Change "Sub SaveAsPDF" to "Sub hungt" -> SaveAs -> hungt.xlsm

    2. Open the file from post #1 again -> paste the code from post #7 -> correct the code to match your data:
    Please Login or Register  to view this content.
    3. Run sub hungt and sub Or_So_Maybe
    Compare the sita.PDF and sita_new.PDF files.

    Don't see any difference?

  10. #10
    Forum Contributor
    Join Date
    02-16-2011
    Location
    Maharashtra, Thane
    MS-Off Ver
    Excel 2021
    Posts
    241

    Re: Print PDF in one sheet

    Hungt Sir, I am using your code now and working fine without any error. Actually i have not found any difference in both of the codes. Both codes tried and both are save in the mentioned folder. Thanks you both. Cheers!

  11. #11
    Valued Forum Contributor
    Join Date
    05-02-2013
    Location
    Poland
    MS-Off Ver
    Excel 2013
    Posts
    368

    Re: Print PDF in one sheet

    For me there is such a difference
    Attached Images Attached Images

  12. #12
    Forum Contributor
    Join Date
    02-16-2011
    Location
    Maharashtra, Thane
    MS-Off Ver
    Excel 2021
    Posts
    241

    Re: Print PDF in one sheet

    Yes Sir. I have not noticed it. Now see this difference while your code of pdf is only one page. I am using your code as given earlier and not noticed the second code clearly.

+ 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. Attach a macro to a print button that will print a certain row on my sheet
    By neen149 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 01-09-2021, 05:24 PM
  2. [SOLVED] Button To Print Specific cell Range On One Sheet In Print Selection
    By diddy47 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-03-2020, 06:23 AM
  3. Print Macro for multiple but different print pages of the same sheet
    By dgarrod in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-18-2017, 02:55 PM
  4. [SOLVED] All data print in one sheet with Multiple Print Area seletion
    By rajeshn_in in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 03-10-2017, 11:49 AM
  5. VBA code to have print button and print the required area in sheet.
    By Ishwarind in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-09-2016, 03:54 AM
  6. Macro slows down when I print/print preview/page break a sheet
    By Grug in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-07-2015, 08:59 PM
  7. Replies: 1
    Last Post: 11-24-2005, 07:29 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