+ Reply to Thread
Results 1 to 9 of 9

Need code for print and export for the dyanamic range selection if extended the data range

  1. #1
    Forum Contributor
    Join Date
    07-27-2018
    Location
    Jodhpur, India
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 Pro 64-bit)
    Posts
    405

    Need code for print and export for the dyanamic range selection if extended the data range

    Hi All,

    Greetings!!

    I created an excel report (added a conclusion under some analysis header) in which I want to add a print and export button. I also created a userform for the export button, but I'm not sure what the exact vba coding for the dynamic selection range according to the field shown will be, or if the field is extended by the existing VBA coding execution, the print or export selection range will be extended. If the analysis is not fit on any page when printed or exported, it will appear on the following page. This implies that if the whole conclusion with analysis header is not fit on any page, a page break will be applied from that analysis header as per the sample pdf format.

    Can a VBA expert help me on this? I'll be eternally thankful to him.
    Attached Files Attached Files
    Last edited by Pankaj jaswani; 12-28-2022 at 04:15 AM.

    PJ


    Learning One New Thing Everyday!

  2. #2
    Forum Contributor
    Join Date
    07-27-2018
    Location
    Jodhpur, India
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 Pro 64-bit)
    Posts
    405

    Re: Need code for print and export for the dyanamic range selection if extended the data r

    Hi Experts,

    Can someone help me in this post?

  3. #3
    Forum Contributor
    Join Date
    07-27-2018
    Location
    Jodhpur, India
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 Pro 64-bit)
    Posts
    405

    Re: Need code for print and export for the dyanamic range selection if extended the data r

    Can a true VBA expert support me on this?

  4. #4
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Question Re: Need code for print and export for the dyanamic range selection if extended the data r


    Hi,

    what is your definition of « a true VBA expert » ?!

  5. #5
    Forum Contributor
    Join Date
    07-27-2018
    Location
    Jodhpur, India
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 Pro 64-bit)
    Posts
    405

    Re: Need code for print and export for the dyanamic range selection if extended the data r

    Quote Originally Posted by Marc L View Post

    Hi,

    what is your definition of « a true VBA expert » ?!
    Hello, Marc. Thank you for your response. I mean, can anyone understand what I'm attempting to achieve, and if any vba specialist understands and can help me with the post?

  6. #6
    Forum Expert ByteMarks's Avatar
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    O365 32bit (Windows)
    Posts
    3,176

    Re: Need code for print and export for the dyanamic range selection if extended the data r

    Does this work for you?

    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    07-27-2018
    Location
    Jodhpur, India
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 Pro 64-bit)
    Posts
    405

    Re: Need code for print and export for the dyanamic range selection if extended the data r

    Thank you ByteMarks for responding with the VBA code I needed. Yes, it works, however the content is very small and difficult to see even at 141% usual zoom in the exported pdf file. Can we increase the font size and extend the margins on both sides to make it easier to read? Also, I'd want to ask whether we can print with this coding  or can this be exported into a word document also?

  8. #8
    Forum Expert ByteMarks's Avatar
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    O365 32bit (Windows)
    Posts
    3,176

    Re: Need code for print and export for the dyanamic range selection if extended the data r

    I'm not seeing any issues with the size. the zoom has to be turn off in order to set it to print to one column wide.
    I did find that in the pdf export and print preview, some of the rows were cut off, so I added a bit to them after autofit.


    Please Login or Register  to view this content.
    Usage
    Please Login or Register  to view this content.

  9. #9
    Forum Contributor
    Join Date
    07-27-2018
    Location
    Jodhpur, India
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 Pro 64-bit)
    Posts
    405

    Re: Need code for print and export for the dyanamic range selection if extended the data r

    Hello, ByteMarks!

    Thank you for updating the code. I tested it to its runs in my existing file. It is functional for all three features. Print, then export to "PDF" and "DOC" formats. However, the fonts in my exported PDF file are not readable since we have to zoom in to view it. I'm attaching both pdfs. The first is the one I attached to my post, and the second is the exported pdf of your coding. Is it conceivable that the analysis for PDF will not autofit because the analysis header will extend, causing the pdf content to shrink?

    Can we fix the font size and margin such that the viewable material automatically extends to the next page, but with a page break if any analysis splits into two pages? Similarly, it will work for the print and doc export functionalities as well.

+ 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. VBA Code Extended Selected (multiple selection) Not Working
    By Rick-O-Shay in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-15-2020, 02:50 AM
  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. [SOLVED] Dynamic Print Range for PDF Export
    By hamidxa in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-07-2019, 01:41 AM
  4. [SOLVED] Possible vba export specific sheets to pdf with range selection
    By zrs in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-02-2019, 01:52 PM
  5. Replies: 4
    Last Post: 12-19-2014, 06:50 PM
  6. Code to select a range and set it as the print range onto one page
    By rlsublime in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-10-2011, 03:37 PM
  7. Dyanamic range - Object Required Error?
    By Craigm in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-06-2006, 11:47 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