Print a RichTextBox
By: Waty Thierry Date: 30/10/1998


1.27 KB

Download now!

This module contains a function and a set of API declarations that let you print the contents of RTFBox, retaining formatting, with just a line of code!


PrintRTF(rtf, left, top, right, bottom)


rtf: name of the RichTextBox to print
left: width of the left margin on printed page
top: height of the top margin on printed page
right: width of the right margin on printed page
bottom: height of the bottom margin on printed page

Type of data



True if the printing procedure completes successfully
False if there are errors


The following code print the contents of the RichTextBox named
rtfMyDocument with no margins and shows a message box if there are errors:

Dim X As Boolean
X = PrintRTF(rtfMyDocument, 0, 0, 0, 0)
If Not X Then
    MsgBox "There are errors!"
End If

The function is contained in a module. You can cut and paste it in any program of yours.

Click Here!

Visual Basic Programming Zone is a website by Lorenzo Dalla Vecchia.
To contact the Webmaster, click here.
Hosted by InWind: