Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Export Text To File 1

Status
Not open for further replies.

kv1712

Programmer
Jun 13, 2000
3
0
0
CA
Call me stupid for asking, but does anyone know how to export an object.text to a file?
 
They're aren't any stupid people here.<br><br>Make a form with 2 text boxes on it: Text1 and Text2. Add the following code in a command button click event, start the program, type some words in Text1 and click the button.<br><br>ff = FreeFile<br>Open &quot;MyFile.Txt&quot; For Binary As #ff<br>Put #ff, , Text1.Text<br>Close #ff<br><br>'We've just written the contents of Text1 to a file.<br><br>ff = FreeFile<br>Open &quot;MyFile.Txt&quot; For Binary As #ff<br>&nbsp;&nbsp;&nbsp;&nbsp;'In order to read the entire file in one pass we'll have to place it in a buffer large enough to hold it.<br>&nbsp;&nbsp;&nbsp;&nbsp;Do that with LOF.<br>Fbuffer$ = String$(LOF(ff), 0)<br>Get #ff, , Fbuffer$<br>Close #ff<br>Text2.Text = Fbuffer$<br><br>Text2 will contain the same text as Text1.<br><br>Hope that helps.<br> <p> <br><a href=mailto: > </a><br><a href= plain black box</a><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top