Solved

richtextbox to notepad file

Posted on 1998-11-22
7
318 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
[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
  • 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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
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…
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 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, 7 hours left to enroll

615 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