Solved

richtextbox to notepad file

Posted on 1998-11-22
7
303 Views
Last Modified: 2006-11-17
How could one copy the contents of richtextbox to a notepad file.

Thank you
0
Comment
Question by:vern123
  • 4
  • 3
7 Comments
 
LVL 14

Accepted Solution

by:
waty earned 50 total points
ID: 1446214
You have to use the text property of the RTF.
You have several solution to add it in your notepad :
1: Use the Clipboard
     Clipboard.Clear
     Clipboard.SetText rtf.SelText, vbCFText
   After that, you can paste the code in the notepad

2: Use file. Save the text to a file, and load that file in the notepad
0
 

Author Comment

by:vern123
ID: 1446215
Could I have sample code for option 2, thank you.
0
 

Author Comment

by:vern123
ID: 1446216
I dont want to do this manually,
It should be a procedure

0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
LVL 14

Expert Comment

by:waty
ID: 1446217
Don't forget to select the needed text to save.
rtf.SelStart = 0
rtf.SelLength = Len(rtf.Text)

   nFile = FreeFile
   Open sFile For Binary Access Write As #nFile

   Put #nFile, , rtf.SelText

   Close #nFile

0
 

Author Comment

by:vern123
ID: 1446218
  Dim pathname As String
   pathname = "C:/prod/temp.txt"
 
   RichTextBox1.SelStart = 0
   RichTextBox1.SelLength = Len(RichTextBox1.Text)

   'nFile = FreeFile 'what is this?
   Open pathname For Binary Access Write As #nFile
   Put #nFile, , RichTextBox1.SelText
   Close #nFile
 
   Shell "notepad " + pathname, 3
 
Thank for help,
does not know #nfile? what is wrong above?

   
0
 
LVL 14

Expert Comment

by:waty
ID: 1446219
nFile = Freefile :
 It takes a new free handle when opening/writing to a file.
0
 

Author Comment

by:vern123
ID: 1446220
:)
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

Suggested Solutions

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…
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…
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…

828 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