+ Reply to Thread
Results 1 to 9 of 9

Printing a UserForm

  1. #1
    Registered User
    Join Date
    01-21-2019
    Location
    Australia
    MS-Off Ver
    Office 2018
    Posts
    35

    Printing a UserForm

    Hi everyone!

    Bit of a tricky one I think, I have a program which will be used by multiple people and at the end, they will need to save a capture of the user form. To save the hassle of forcing them to use the snipping tool, is there a way in which I can use VBA and a command button to save the user form as an image file to the users desktop? Just the form, not just printing the entire screen. I have been doing some reading where others have asked similar questions but nothing seems to have worked thus far.

  2. #2
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,303

    Re: Printing a UserForm

    Please Login or Register  to view this content.

  3. #3
    Forum Expert nigelog's Avatar
    Join Date
    12-14-2007
    Location
    Cork, Ireland
    MS-Off Ver
    Office 365 Windows 10
    Posts
    2,286

    Re: Printing a UserForm

    https://www.excelforum.com/showthrea...21540#poststop

  4. #4
    Registered User
    Join Date
    01-21-2019
    Location
    Australia
    MS-Off Ver
    Office 2018
    Posts
    35

    Re: Printing a UserForm

    Thank you both for your answers. Apologies if I was not clear, as I don't need the form to be physically printed, only to have a PDF of the userform saved.
    Is there a way through using VBA to set the default printer to "Print to PDF" for this form?

  5. #5
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Printing a UserForm

    This works fine for me.

    Change pdfName to suit.

    Please Login or Register  to view this content.
    Last edited by bakerman2; 06-17-2019 at 01:04 AM.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  6. #6
    Registered User
    Join Date
    01-21-2019
    Location
    Australia
    MS-Off Ver
    Office 2018
    Posts
    35

    Re: Printing a UserForm

    Thanks Bakerman2, I pasted this code into my userform, however the line
    Please Login or Register  to view this content.
    appears red as though there is an error, as well as when attempting to run this code by pressing the command button it returns the error "Method 'PasteSpecial' of object '_Worksheet' failed" and highlights the line
    Please Login or Register  to view this content.
    Any advice?

  7. #7
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Printing a UserForm

    Works fine for me.
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    01-21-2019
    Location
    Australia
    MS-Off Ver
    Office 2018
    Posts
    35

    Re: Printing a UserForm

    It seems as though it works fine in the attached file, yet something is wrong in my implementation. Thank you for this though! I will continue playing around and see if I can get it working!

  9. #9
    Registered User
    Join Date
    01-21-2019
    Location
    Australia
    MS-Off Ver
    Office 2018
    Posts
    35

    Re: Printing a UserForm

    Finally got it working! It seems as though I need to select the userform first before it creates the PDF successfully. Only question now is that the screenshot it creates is just too large to fit on one page, is it possible to scale the PDF down to say 80% original size to fit on one page?

    Thank you again very much for all your help!

+ 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. Printing a UserForm
    By dgingrey in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-30-2013, 12:04 PM
  2. userform for printing
    By blackman87 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 04-20-2010, 07:53 AM
  3. UserForm Printing
    By PATRON58 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-02-2007, 02:30 AM
  4. Userform Printing
    By sparx in forum Excel General
    Replies: 8
    Last Post: 07-31-2006, 04:00 AM
  5. Userform - Printing
    By Greg B in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 09-15-2005, 09:05 PM
  6. userform printing
    By Access in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-10-2005, 12:05 AM
  7. [SOLVED] Userform - Printing
    By Greg B in forum Excel General
    Replies: 8
    Last Post: 03-13-2005, 11:06 AM
  8. [SOLVED] Userform - Printing
    By Greg B in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 03-13-2005, 11:06 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