+ Reply to Thread
Results 1 to 12 of 12

To print a userform

  1. #1
    Forum Contributor funkymonkUK's Avatar
    Join Date
    01-07-2005
    Location
    London, England
    Posts
    500

    Question To print a userform

    Hi

    What I am trying to do is make my workbook based on a userform is there a way that once a user has completed the information that they have entered can they print the userform with all the data added to it. I have multiple entries. I have a sheet which all the information is stored under. What I want is to be able to select a month that was entered and then print off all the details of the stuff that was entered in.

    Any ideas??

  2. #2
    Forum Contributor funkymonkUK's Avatar
    Join Date
    01-07-2005
    Location
    London, England
    Posts
    500
    CAN someone not help me??

  3. #3
    Forum Contributor funkymonkUK's Avatar
    Join Date
    01-07-2005
    Location
    London, England
    Posts
    500
    13 views and nobody can help me?? if there can someone at least say something.

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

    Neither Excel or VBA directly support printing of User Forms. It can be done. I will have to do a little research on it though. I rememeber it involves several API calls to get the job done. You may be able to track it down yourself on Google. In the mean time, I will look into it, and post what I find.

    Sincerely,
    Leith Ross

  5. #5
    Forum Contributor funkymonkUK's Avatar
    Join Date
    01-07-2005
    Location
    London, England
    Posts
    500
    Thanks Leith I managed to find something like the below

    Private Sub CommandButton4_Click()
    UserForm1.PrintForm
    End Sub

    I have also attached the definition for anybody. Only problem is how do I specify whether I want the page to print Landscape or Portrait?

    Below is the definition

    PrintForm Method
    Applies To

    UserForm object.

    Description

    Sends a bit-by-bit image of a UserForm object to the printer.

    Syntax

    object.PrintForm

    The object placeholder represents an object expression that evaluates to an object in the Applies To list. If object is omitted, the UserForm with the focus is assumed to be object.

    Remarks

    PrintForm prints all visible objects and bitmaps of the UserForm object. PrintForm also prints graphics added to a UserForm object.

    The printer used by PrintForm is determined by the operating system's Control Panel settings.

    Example

    In the following example, the client area of the form is printed when the user clicks the form.

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


    Hope we can solve this problem together. let me know thanks

  6. #6
    Forum Contributor funkymonkUK's Avatar
    Join Date
    01-07-2005
    Location
    London, England
    Posts
    500

  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,258
    Hello FunkyMonk,

    That you for that post. I learned an easier way to do it. My apologies for stating that VBA did not a method of printing out the form. Good job!

    Sincerely,
    Leith Ross

  8. #8
    Forum Contributor funkymonkUK's Avatar
    Join Date
    01-07-2005
    Location
    London, England
    Posts
    500
    anybody know how to change the page layout with this code?

  9. #9
    Forum Contributor funkymonkUK's Avatar
    Join Date
    01-07-2005
    Location
    London, England
    Posts
    500
    how do I specify whether I want the userform to print Landscape or Portrait?

  10. #10
    Forum Contributor
    Join Date
    06-10-2004
    Location
    India
    Posts
    1,066
    There is no option for the layout in the VBE's print function. So i guess this will have to be set through the printers default layout setting

    - Mangesh

  11. #11
    Forum Contributor funkymonkUK's Avatar
    Join Date
    01-07-2005
    Location
    London, England
    Posts
    500
    any chance of changing this setting and then switching back?

  12. #12
    Forum Contributor funkymonkUK's Avatar
    Join Date
    01-07-2005
    Location
    London, England
    Posts
    500
    anybody still got this problem

+ 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