Solved

Saving dat from multiple rich text boxes to a file

Posted on 1998-11-24
4
135 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

734 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