Click to See Complete Forum and Search --> : It's better than sex !
stjepan
Oct 9th, 2000, 07:25 PM
How I can print the content of RichTextBox with margins ?
Assuming that the RichTextBox's margins are already set:
Private Sub cmdPrint_Click()
Printer.Print RichTextBox1.Text
Printer.EndDoc
End Sub
That should print everything in the RichTextBox as is.
oetje
Oct 10th, 2000, 12:37 AM
Matthew, your code doesn't print the formatting...
Dim OldSelStart As Long
Dim OldSelLength As Long
OldSelStart = RichTextBox1.SelStart
OldSelLength = RichTextBox1.SelLength
RichTextBox1.SelStart = 1
RichTextBox1.SelLength = Len(RichTextBox1.Text)
RichTextBox1.SelPrint
RichTextBox1.SelStart = OldSelStart
RichTextBox1.SelLength = OldSelLength
And yours doesn't full formatting. Use the SelPrint method for it instead.
RichTextBox1.SelPrint Printer.hDC
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.