+ Reply to Thread
Results 1 to 8 of 8

UserForm Print Preview

  1. #1
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    UserForm Print Preview

    I have a user form with a "Print" button with this code
    Please Login or Register  to view this content.
    The button prints the user form as expected. What I'd like to do is send the user form to "Print Preview" and allow the user to change printers and/or printer options (landscape, portrait, etc.).

    I've spent considerable time with Google and haven't found a way to do this. Any help is greatly appreciated.

    John
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: UserForm Print Preview

    Hello John,

    Unfortunately, there does not exist a call in VBA or Excel to do a Print Preview of a UserForm. However, it can be done but is not a simple task, even though it seems like it should be. It involves a lot of heavy API calls to transfer the contents of the UserForm to the Printer in a binary format so that it can be printed out correctly.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: UserForm Print Preview

    I can't really see why you want t oprint a UseForm,nuch better to write the contents to a Form set up on a sheet for printing. You can select the printer by adding
    Please Login or Register  to view this content.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  4. #4
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: UserForm Print Preview

    Hi Leith
    I figured after searching Google for a couple of hours and not finding a hit that there was probably no simple solution. Thanks for your input.

    Hi royUK
    I had this
    Please Login or Register  to view this content.
    but it doesn't help with my issue. Thanks for your input.

    John

  5. #5
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: UserForm Print Preview

    Hello John,

    I don't have the time right now to code the API for a Print Preview function, but it would be a interesting project and worthwhile to have. When were looking to add this into your project?

  6. #6
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: UserForm Print Preview

    Hi Leith

    I'm using
    Please Login or Register  to view this content.
    currently and this works. I'd like to give the user more control over the print event rather than sending directly to the printer. So, there's no rush. I appreciate your willingness to help.

    John

  7. #7
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: UserForm Print Preview

    Hello John,

    It is a macro that should have been provided in VBA but for what ever reason wasn't. After it is written, I'll post it back in this thread.

  8. #8
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: UserForm Print Preview

    Hi Leith

    That's very generous of you. Thank you.

    John

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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