Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

richtextbox to notepad file

Posted on 1998-11-22
7
Medium Priority
?
323 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 200 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
Technology Partners: 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!

 
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

Enroll in September's Course of the Month

This month’s featured course covers 16 hours of training in installation, management, and deployment of VMware vSphere virtualization environments. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

722 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