Solved

Saving dat from multiple rich text boxes to a file

Posted on 1998-11-24
4
129 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
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…

743 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now