HI All,

I have this function that sets the contents of a Rich text box to bold and sets some of the text red, What I want to know is how can I print the contents of the Rich text box as it is seen in my program (Bold and red)? as at the moment it prints it all out as normal text.


VB Code:
  1. Private Sub Show_Failed_Conversions()
  2.     Dim currentnumber As Long
  3.     Dim newnum As Integer
  4.     Dim oldnum As Integer
  5.     Dim FindBracket As Integer
  6.     'Add time and data to the log file
  7.     frmQConversion.txtLogFails.Text = "Time: " & Format$(Now, "hh:mm:ss") & vbCrLf & "Date: " & Format$(Now, "dd/mm/yy") & vbCrLf & vbCrLf
  8.    
  9.     'Loop though the collection and add items to the log file
  10.     For currentnumber = 1 To holder.Count Step 1
  11.        
  12.         frmQConversion.txtLogFails.Text = frmQConversion.txtLogFails.Text & holder(currentnumber) & holdName(currentnumber) & " to " & HoldMe(currentnumber) & vbCrLf
  13.         frmQConversion.txtLogFails.SelStart = 0
  14.         frmQConversion.txtLogFails.SelLength = Len(frmQConversion.txtLogFails.Text)
  15.         frmQConversion.txtLogFails.SelBold = True
  16.     Next currentnumber
  17.         newnum = 1
  18.         oldnum = 2
  19.         For FindBracket = 1 To Len(frmQConversion.txtLogFails.Text) Step 2
  20.             oldnum = InStr(oldnum, frmQConversion.txtLogFails.Text, "[")
  21.             newnum = InStr(newnum, frmQConversion.txtLogFails.Text, "]")
  22.                 If oldnum = 0 Then
  23.                     Exit For
  24.                 Else
  25.             frmQConversion.txtLogFails.SelStart = oldnum - 1
  26.             frmQConversion.txtLogFails.SelLength = (newnum - oldnum + 1)
  27.             frmQConversion.txtLogFails.SelBold = True
  28.             frmQConversion.txtLogFails.SelColor = vbRed
  29.             oldnum = newnum + 1
  30.             newnum = newnum + 2
  31.                 End If
  32.         Next FindBracket
  33.        
  34.     'Clear the collection
  35.     Set holder = Nothing
  36.     Set holdName = Nothing
  37.     Set HoldMe = Nothing
  38. End Sub

And here is where im printing it.

VB Code:
  1. Private Sub cmbPrintLog_Click()
  2.     Printer.Print txtLogFails.Text
  3.     Printer.EndDoc
  4. End Sub

Thanks

Loftty