Solved

Saving dat from multiple rich text boxes to a file

Posted on 1998-11-24
4
132 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 50 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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 Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

809 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