?
Solved

Writing an HTM File from a Textbox or Rich Textbox

Posted on 2003-03-08
5
Medium Priority
?
136 Views
Last Modified: 2010-04-07
I need to write a file from the data this is entered into a RichTextBox to an HTM document.  I have written it to a RTF, but when I try to recall that file as part of a web page, using IFRAME (Cause OBJECT won't work), I get the text editor window with the test.  If my information is saved as an HTM, then I get the result in my web for that I need.

Thanks,
Joe
0
Comment
Question by:tobey1
[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
  • 3
5 Comments
 
LVL 22

Expert Comment

by:rspahitz
ID: 8096787
Is there any special formatting in the RTF file?  If not then it should be as simple as:

strHTML = replace(rtbInfo.Text, vbnewline, "<P>" & vbnewline)

When you output strHTML, it will have the line breaks at the proper place.  If you want to get fancier, you can also output it with a header and footer:

open "my_RTF.htm" for output as #1

print #1, "<HTML>"
print #1, "<HEAD>"
print #1, "<TITLE>This used to be RTF</TITLE>"
print #1, "</HEAD>"
print #1, ""
print #1, "<BODY>"
print #1, strHTML
print #1, "</BODY>"
print #1, "</HTML>"

close #1
0
 
LVL 2

Accepted Solution

by:
spauljoseph earned 200 total points
ID: 8096991
Download the Module containing a function for doing this from the site http://zephyrit.netfirms.com/rtf2html.bas
0
 
LVL 2

Expert Comment

by:spauljoseph
ID: 8097019
Sorry. If you click on the link, it will open it in the Explorer. Please Right click the above link and choose Save Target As...

Thanks
0
 
LVL 5

Author Comment

by:tobey1
ID: 8113034
What exactly is that link giving me and how can I use it in my ActiveX form?
0
 
LVL 2

Expert Comment

by:spauljoseph
ID: 8281443
Thanks for accepting my comments.

Sorry. I've never seen your question in this question as I've forgotten answering this question.

The answer for ur question is...

Juse place a WebBrowser control in your form and an RichTextBox control with a command button named Show.

'Place the following code in the event as mentioned

Private Sub Command1_Click()
   With WebBrowser1
       .Document.Script.Document.Clear
       .Document.Script.Document.Write Module1.RTF2HTML(RichTextBox1.TextRTF)
       .Document.Script.Document.Close
   End With
End Sub
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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 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…
Suggested Courses
Course of the Month8 days, 14 hours left to enroll

764 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