How do you save plain text in a rich text box?
Printable View
How do you save plain text in a rich text box?
Is this what you want to do?
Code:
Option Explicit
Private Sub Command1_Click()
SavePlainText RichTextBox1, "c:\rawtext.txt"
End Sub
Private Sub SavePlainText(Rtb As RichTextBox, filename As String)
Dim fnum As Byte
fnum = FreeFile
Open filename For Binary As fnum
Put #fnum, , Rtb.Text
Close fnum
End Sub
Mark,
What does your signature mean? I converted it to dec, but I couldnt take anything valuable from doing that?
You have me intrigued.
it is just the ascii values for "Mark Sreeves" in binary.
for some reason the spacing goes all weird though.
the digits should of-course be in groups of 8
[Edited by Mark Sreeves on 07-18-2000 at 08:42 AM]
A shorter method is to use the built in SaveFile method and pass rtfText as the flag.
Code:'Pass rtfText as the flag. This tells the RichTextBox to save in plain text.
RichTextBox1.SaveFile "C:\MyFile.txt", rtfText