+ Reply to Thread
Results 1 to 9 of 9

Printing a User Form

  1. #1
    mully
    Guest

    Printing a User Form

    I have a user form using columns A-V in Excel which scrolls down to Row 200.
    Each row contains customer details in the colums A to V e.g, Name/Address/
    Contact Numbers/ Age etc. As I scroll down the list of custermers their
    details appear in the relevant boxes on the User Form. Is it possible when a
    customers details fill in the relevant boxes that I can print the User Form
    with just their details. I hane placed a Command Button ( Print ) on the User
    Form however cannot get it to print. Any help would be much appreciated.

  2. #2
    Jan Karel Pieterse
    Guest

    Re: Printing a User Form

    Hi Mully,

    > I hane placed a Command Button ( Print ) on the User
    > Form however cannot get it to print.
    >


    Doesn't:

    UserForm1.PrintForm

    work?

    Regards,

    Jan Karel Pieterse
    Excel MVP
    http://www.jkp-ads.com


  3. #3
    mully
    Guest

    Re: Printing a User Form

    Thanks for prompt answer - however I may have phrased the query wrong. I can
    get the user form to print when I open it in VBA mode with the statement
    UserForm1.PrintForm but when the User Form opens in Excel sheet ( Customers )
    and all their details enter the various boxes for that particular customer it
    will not print that user form with the customers details. Does that explain
    it better???

    Regards Mully.

    "Jan Karel Pieterse" wrote:

    > Hi Mully,
    >
    > > I hane placed a Command Button ( Print ) on the User
    > > Form however cannot get it to print.
    > >

    >
    > Doesn't:
    >
    > UserForm1.PrintForm
    >
    > work?
    >
    > Regards,
    >
    > Jan Karel Pieterse
    > Excel MVP
    > http://www.jkp-ads.com
    >
    >


  4. #4
    Jan Karel Pieterse
    Guest

    Re: Printing a User Form

    Hi Mully,

    > Thanks for prompt answer - however I may have phrased the query wrong. I can
    > get the user form to print when I open it in VBA mode with the statement
    > UserForm1.PrintForm but when the User Form opens in Excel sheet ( Customers )
    > and all their details enter the various boxes for that particular customer it
    > will not print that user form with the customers details. Does that explain
    > it better???


    It works fine for me. I just tried by using a simple form with a button and an
    editbox with the following code attached to the button:

    Private Sub CommandButton1_Click()
    Me.PrintForm
    End Sub

    Regards,

    Jan Karel Pieterse
    Excel MVP
    http://www.jkp-ads.com


  5. #5
    mully
    Guest

    Re: Printing a User Form

    Hi Jan,
    Thanks for all your help still struggling inserted following code in to VBA

    ' This is the click event for UserForm1
    Private Sub CommandButton510_Click()
    UserForm1.PrintForm
    End Sub

    all it does is print the user form in VBA mode and not the excel mode with
    all members details in the boxes. I inherited the program and being a new
    user to excel
    find it difficult to write the necessary code to print the form when it
    activates in excel - does this explanation help????

    Cheers Mully

    "Jan Karel Pieterse" wrote:

    > Hi Mully,
    >
    > > Thanks for prompt answer - however I may have phrased the query wrong. I can
    > > get the user form to print when I open it in VBA mode with the statement
    > > UserForm1.PrintForm but when the User Form opens in Excel sheet ( Customers )
    > > and all their details enter the various boxes for that particular customer it
    > > will not print that user form with the customers details. Does that explain
    > > it better???

    >
    > It works fine for me. I just tried by using a simple form with a button and an
    > editbox with the following code attached to the button:
    >
    > Private Sub CommandButton1_Click()
    > Me.PrintForm
    > End Sub
    >
    > Regards,
    >
    > Jan Karel Pieterse
    > Excel MVP
    > http://www.jkp-ads.com
    >
    >


  6. #6
    Jan Karel Pieterse
    Guest

    Re: Printing a User Form

    Hi Mully,

    > find it difficult to write the necessary code to print the form when it
    > activates in excel - does this explanation help????


    What do you mean by "activates in Excel"?

    The code I gave you should be tied to a command button that is on the
    userform itself. You can access the code of a button (or any other
    control) from the VBE by double clicking the control in the userform's
    design window.

    Regards,

    Jan Karel Pieterse
    Excel MVP
    http://www.jkp-ads.com


  7. #7
    mully
    Guest

    Re: Printing a User Form

    Hi Jan,

    Absolutely brilliant - I just wrote the code not knowing that the command
    button was on another sheet with your explanation of clicking twice on the
    button in VBA it threw me on to the right sheet and code - just added
    UserForm1.PrintForm in the correct place and it worked perfectly. Thank you
    again

    Regards

    Mully

    "Jan Karel Pieterse" wrote:

    > Hi Mully,
    >
    > > find it difficult to write the necessary code to print the form when it
    > > activates in excel - does this explanation help????

    >
    > What do you mean by "activates in Excel"?
    >
    > The code I gave you should be tied to a command button that is on the
    > userform itself. You can access the code of a button (or any other
    > control) from the VBE by double clicking the control in the userform's
    > design window.
    >
    > Regards,
    >
    > Jan Karel Pieterse
    > Excel MVP
    > http://www.jkp-ads.com
    >
    >


  8. #8
    Registered User
    Join Date
    05-28-2018
    Location
    Pakistan
    MS-Off Ver
    Office 365
    Posts
    7

    Re: Printing a User Form

    Can anyone please help me, my Print command is working properly, but I want to print the whole form. Right now it is printing just a small portion of it. How can I set it? Is it possible? My user-form is quite long.

    Thanks

  9. #9
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 2000/3/7/10/13/16
    Posts
    48,605

    Re: Printing a User Form

    Shozib Javaid welcome to the forum

    Unfortunately your post does not comply with Rule 2 of our Forum RULES. Do not post a question in the thread of another member -- start your own thread.

    If you feel an existing thread is particularly relevant to your need, provide a link to the other thread in your new thread.

    Old threads are often only monitored by the original participants. New threads not only open you up to all possible participants again, they typically get faster response, too.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

+ 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