Results 1 to 5 of 5
  1. #1
    4 Star Lounger
    Join Date
    May 2003
    Location
    Austin
    Posts
    401
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Print in UserForm

    I'm new at programming in WORD, but I can read the code. I attached a command button on a user form of a template and I want it to print to the users default printer. How would this code work?

  2. #2
    Silver Lounger Charles Kenyon's Avatar
    Join Date
    Jan 2001
    Location
    Sun Prairie, Wisconsin, Wisconsin, USA
    Posts
    2,049
    Thanks
    124
    Thanked 119 Times in 116 Posts

    Re: Default Print in UserForm

    To get the code, record a macro. Then modify it if needed to use the default printer rather than a specific printer. See my answer to Jay Ratcliffe's question of 2/08 on default printer for a document for some of the terms.

    You may want to consider using a macrobutton rather than an ActiveX control.

    See the links at http://www.addbalance.com/usersguide/forms.htm for more ideas.

    Hope this helps.
    Charles Kyle Kenyon
    Madison, Wisconsin

  3. #3
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts

    Re: Default Print in UserForm

    Do you want to print the userform to the default printer, or the document itself?

    To print out the userform, use:

    Me.PrintForm

    And to print out the document, use:

    ActiveDocument.PrintOut

    Hope this helps,
    Gary

  4. #4
    4 Star Lounger
    Join Date
    May 2003
    Location
    Austin
    Posts
    401
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Default Print in UserForm

    Yes, that worked well.
    Sorry for not being clear. The UserForm was my target.

    How do you print out everything on the form except the 2 buttons, which are named "Close" and "Print"?

  5. #5
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts

    Re: Default Print in UserForm

    Use this:

    Private Sub cmdPrint_Click()
    cmdPrint.Visible = False
    cmdClose.Visible = False
    Me.PrintForm
    cmdPrint.Visible = True
    cmdClose.Visible = True
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •