Solved

richtextbox to notepad file

Posted on 1998-11-22
7
288 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
Comment Utility
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
Comment Utility
Could I have sample code for option 2, thank you.
0
 

Author Comment

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

0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 14

Expert Comment

by:waty
Comment Utility
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
Comment Utility
  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
Comment Utility
nFile = Freefile :
 It takes a new free handle when opening/writing to a file.
0
 

Author Comment

by:vern123
Comment Utility
:)
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
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…
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…

772 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

11 Experts available now in Live!

Get 1:1 Help Now