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:
Private Sub Show_Failed_Conversions() Dim currentnumber As Long Dim newnum As Integer Dim oldnum As Integer Dim FindBracket As Integer 'Add time and data to the log file frmQConversion.txtLogFails.Text = "Time: " & Format$(Now, "hh:mm:ss") & vbCrLf & "Date: " & Format$(Now, "dd/mm/yy") & vbCrLf & vbCrLf 'Loop though the collection and add items to the log file For currentnumber = 1 To holder.Count Step 1 frmQConversion.txtLogFails.Text = frmQConversion.txtLogFails.Text & holder(currentnumber) & holdName(currentnumber) & " to " & HoldMe(currentnumber) & vbCrLf frmQConversion.txtLogFails.SelStart = 0 frmQConversion.txtLogFails.SelLength = Len(frmQConversion.txtLogFails.Text) frmQConversion.txtLogFails.SelBold = True Next currentnumber newnum = 1 oldnum = 2 For FindBracket = 1 To Len(frmQConversion.txtLogFails.Text) Step 2 oldnum = InStr(oldnum, frmQConversion.txtLogFails.Text, "[") newnum = InStr(newnum, frmQConversion.txtLogFails.Text, "]") If oldnum = 0 Then Exit For Else frmQConversion.txtLogFails.SelStart = oldnum - 1 frmQConversion.txtLogFails.SelLength = (newnum - oldnum + 1) frmQConversion.txtLogFails.SelBold = True frmQConversion.txtLogFails.SelColor = vbRed oldnum = newnum + 1 newnum = newnum + 2 End If Next FindBracket 'Clear the collection Set holder = Nothing Set holdName = Nothing Set HoldMe = Nothing End Sub
And here is where im printing it.
VB Code:
Private Sub cmbPrintLog_Click() Printer.Print txtLogFails.Text Printer.EndDoc End Sub
Thanks
Loftty




Reply With Quote