Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Saving dat from multiple rich text boxes to a file

Posted on 1998-11-24
4
Medium Priority
?
138 Views
Last Modified: 2012-05-04
I am trying to save data from nultiple rich text boxes to the same file.  It is only writting the data from the first box out.  When I write the data as text instead of textrtf, then all of the data is outputted, but without the bolding,italic, etc.  This is the code that I am trying to use:
Open "mytext.doc" For Output As 1
        Print #1, RichTextBox3.TextRTF
        Print #1, RichTextBox1.TextRTF
        Print #1, RichTextBox2.TextRTF
        Print #1, RichTextBox4.TextRTF
    Close 1

Any help would be appreciated.
0
Comment
Question by:LesIII
  • 2
4 Comments
 
LVL 8

Expert Comment

by:MikeP090797
ID: 1446578
Try something like this:

Dim S as string
S=rtf1.textrtf
Put #1,,S

0
 
LVL 12

Accepted Solution

by:
mark2150 earned 200 total points
ID: 1446579
Ummm, RTF isn't a simple format. It starts with { and ends with } and I don't believe that it supports multiple files concatented. You can combine the data all day long, but the multiple preambles are going to *kill* you.

You need to create a 5th RTB that you'll use to concatenate the contents of the other four (you can have the .Visible property = False so the user won't see it.). Select all of the text from each of the other boxes and paste, in sequence, into your 5th box. *THEN* you save the contents of the 5th box to disk with:

Public RTFFile As String    '.RTF file name
SaveFile RTFFile, rtfRTF  'Create file

This should work. Let me know if you need more detailed code on the appending of the text.

M


0
 

Author Comment

by:LesIII
ID: 1446580
Thank you for the answer.  I have been going insane trying to figure out how to use Rich text boxes.
0
 
LVL 12

Expert Comment

by:mark2150
ID: 1446581
Wait until you try to figure out how to *PRINT* them! You can set the left and right margins and that is *IT*. It will print multiple pages without page numbers or headings. It does print nicely tho, just doesn't give you any formatting control.

M

0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

783 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question