PrintForm Method

See Also1PKIJ2P              Example682I2I>Low

Sends a bit-for-bit image of a non-MDI form to the printer.




The argument form is the non-MDI form to print.  If omitted, the current form is printed.  PrintForm prints all visible controls and bitmaps on the form.  PrintForm also prints graphics added to the form or picture controls on the form at run timeCYRM35 if AutoRedraw is True when the graphics are drawn.

The printer used by PrintForm is determined by the Microsoft Windows control panel.

See Also

AutoRedraw Property1UY7ZM3

Print Method9V51E5

Printer ObjectCBQUDQ

PrintForm Method Example

The example uses the PrintForm method to print the current form.  To try this example, paste the code into the Declarations section of a form.  Place on the form any controls you want to see in the printed form.  Then press F5 and click the form.


Sub Form_Click ()

   Dim Msg                               ' Declare variable.

   On Error GoTo ErrorHandler            ' Set up error handler.

   PrintForm                             ' Print form.

   Exit Sub


   Msg = "The form could not be printed."

   MsgBox Msg                            ' Display message.

   Resume Next

End Sub